RE: [Tcl-nap-users] writing HDF files
Brought to you by:
dav480,
peter_turner
From: <Pet...@cs...> - 2006-03-15 00:06:40
|
Hi Salah, I apologise, in my last email I missed the h in your name. In relation to this problem I do not understand how the gdalinfo relates to the HDF file structure. Suggest using hdp, or use the HDF GUI in Nap to compare the structure of the HDF files. I think you have lost the coordinate variables associated with green (scale variables). You can also check green by: puts "[$green header]" this will show if coordinate variables attached to green. However, once you do this the NAO associated with green will be lost because you "set green [nap_get ...]" instead of " nap green =3D [nap_get ...]" Cheers Peter T -----Original Message----- From: salah jubeh [mailto:s_...@ya...]=20 Sent: Friday, 10 March 2006 8:48 PM To: Turner, Peter (CMAR, Hobart); tcl...@li... Subject: RE: [Tcl-nap-users] writing HDF files Hi Peter=20 =20 Thanks for advice it was a simple test and also i am anew tcl Programmer. i think you have seen my second post which is again has a title write hdf. =20 Today i test the result of this code with gdalinfo tool =20 set green [nap_get hdf green.hdf "3-dimensional Scientific Dataset"] set TM [nap_get hdf green.hdf :TransformationMatrix] set PR [nap_get hdf green.hdf :Projection] set AP [nap_get hdf green.hdf :AREA_OR_POINT] set TIFFS [nap_get hdf green.hdf :TIFFTAG_SOFTWARE] set TIFFX [nap_get hdf green.hdf :TIFFTAG_XRESOLUTION] set TIFFY [nap_get hdf green.hdf :TIFFTAG_YRESOLUTION] set TIFFU [nap_get hdf green.hdf :TIFFTAG_RESOLUTIONUNIT] $green hdf test.hdf "3-dimensional Scientific Dataset" $TM hdf test.hdf ":TransformationMatrix" $PR hdf test.hdf ":Projection" $AP hdf test.hdf ":AREA_OR_POINT" $TIFFS hdf test.hdf ":TIFFTAG_SOFTWARE" $TIFFX hdf test.hdf ":TIFFTAG_XRESOLUTION" $TIFFY hdf test.hdf ":TIFFTAG_YRESOLUTION" $TIFFU hdf test.hdf ":TIFFTAG_RESOLUTIONUNIT" =20 The too images suppose to be identical but the result was not as i expected. =20 The origenal image information " green.hdf" C:\projects\gdal-1.3h\apps>gdalinfo.exe c:\tclhttpd\htdocs\raster\data\green.hdf Driver: HDF4Image/HDF4 Dataset Size is 615, 529 Coordinate System is: PROJCS["IMAGINE GeoTIFF Support Copyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved @(#)$RCSfile: egtf.c $ $Revision: 1.10.1.6 $ $Date: 2003/10/17 16:36:51EDT $ Projection Name =3D Transverse Mercator Uni", GEOGCS["IMAGINE GeoTIFF Support Copyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved @(#)$RCSfile: egtf.c $ $Revision: 1.10.1.6 $ $Date: 2003/10/17 16:36:51EDT $ Unable to match Ellipsoid (Datum) to a Ge", DATUM["unknown", =09 SPHEROID["unnamed",6378137,298.2572220960423]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",24], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], UNIT["metre",1, AUTHORITY["EPSG","9001"]]] Origin =3D (477701.230832,3928005.705781) Pixel Size =3D (0.63939200,-0.63939200) Metadata: Signature=3DCreated with GDAL (http://www.remotesensing.org/gdal/) TransformationMatrix=3D477701.230832, 0.639392, 0.000000, 3928005.705781, 0.0000 00, -0.639392 Projection=3DPROJCS["IMAGINE GeoTIFF Support Copyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved @(#)$RCSfile: egtf.c $ $Revision: 1.10.1.6 $ $Date: 2003/10/17 16:36:51EDT $ Projection Name =3D Transverse Mercator Uni",GEOGCS["IMAGINE GeoTIFF Support Copyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved @(#)$RCSfile: egtf.c $ $Revision: 1.10.1.6 $ $Date: 2003/10/17 16:36:51EDT $ Unable to match Ellipsoid (Datum) to a Ge",DATUM["unknown",SPHEROID["unnamed",63 =09 78137,298.2572220960423]],PRIMEM["Greenwich",0],UNIT["degree",0.01745329 25199433 =09 ]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],P ARAMETER =09 ["central_meridian",24],PARAMETER["scale_factor",0.9996],PARAMETER["fals e_eastin =09 g",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG" ,"9001"] ]] AREA_OR_POINT=3DArea TIFFTAG_SOFTWARE=3DIMAGINE TIFF Support Copyright 1991 - 1999 by ERDAS, Inc. All Rights Reserved @(#)$RCSfile: etif.c $ $Revision: 1.10.1.9 $ $Date: 2003/11/13 19:25:49EST $ TIFFTAG_XRESOLUTION=3D1 TIFFTAG_YRESOLUTION=3D1 TIFFTAG_RESOLUTIONUNIT=3D1 (unitless) Corner Coordinates: Upper Left ( 477701.231, 3928005.706) Lower Left ( 477701.231, 3927667.467) Upper Right ( 478094.457, 3928005.706) Lower Right ( 478094.457, 3927667.467) Center ( 477897.844, 3927836.587) Band 1 Block=3D615x1 Type=3DUInt16, ColorInterp=3DGray=20 The result image information " test.hdf" =20 C:\projects\gdal-1.3h\apps>gdalinfo.exe c:\tclhttpd\htdocs\raster\data\test.hdf Driver: HDF4Image/HDF4 Dataset Size is 615, 529 Coordinate System is `' Metadata: TransformationMatrix=3D477701.230832, 0.639392, 0.000000, 3928005.705781, 0.0000 00, -0.639392 Projection=3DPROJCS["IMAGINE GeoTIFF Support Copyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved @(#)$RCSfile: egtf.c $ $Revision: 1.10.1.6 $ $Date: 2003/10/17 16:36:51EDT $ Projection Name =3D Transverse Mercator Uni",GEOGCS["IMAGINE GeoTIFF Support Copyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved @(#)$RCSfile: egtf.c $ $Revision: 1.10.1.6 $ $Date: 2003/10/17 16:36:51EDT $ Unable to match Ellipsoid (Datum) to a Ge",DATUM["unknown",SPHEROID["unnamed",63 =09 78137,298.2572220960423]],PRIMEM["Greenwich",0],UNIT["degree",0.01745329 25199433 =09 ]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],P ARAMETER =09 ["central_meridian",24],PARAMETER["scale_factor",0.9996],PARAMETER["fals e_eastin =09 g",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG" ,"9001"] ]] AREA_OR_POINT=3DArea TIFFTAG_XRESOLUTION=3D1 TIFFTAG_YRESOLUTION=3D1 TIFFTAG_RESOLUTIONUNIT=3D1 (unitless) _FillValue=3D65535 Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 529.0) Upper Right ( 615.0, 0.0) Lower Right ( 615.0, 529.0) Center ( 307.5, 264.5) Band 1 Block=3D615x1 Type=3DUInt16, ColorInterp=3DGray This is the reason that i can not see my image. because i define the extent in my bviewer and the new image has extent 0,0,615,520 insted of 477701.230832036580,3927667.467451686000,478094.456867, 3928005.70578=20 =20 I want to ask why this happen, how can i create anew image have the same meta data but diffrent cell values. =20 =20 Pet...@cs... wrote: Hi salah, =20 You seem to have sorted out how to write multiple SDSs and attributes.=20 I am not sure if you are aware but you need to be careful mixing NAOs and tcl commands. Your example below is a bit dangerous if you want to use x for anything else. NAOs have a reference count which counts the number of tcl variables pointing at them. If the NAO reference count goes to 0 then the NAO kills itself. In order to create a relationship between the NAO and a tcl variable the nap command needs to be used: nap x =3D [nap_get hdf .......] In the above case the NAO will have a reference count of 1 and be attached to x so that if x gets unset the reference count on the NAO will be decremented and if the reference count is zero it will disappear. In your example, although x points to the NAO the reference count on the NAO will be 0. In this case the NAO is a bit smart an says, hey, you just created me, even though I have a zero reference count I must be needed for something so I will hang around until something happens. In your case you wrote straight back to an HDF file. However, once that event happened the NAO will disappear so trying to do anything further with x/NAO will not work. It is important to understand this, because if you do not you can get into lots of trouble. You cannot get rid of the fillvalue at present using nap. I doubt that this is causing a problem. I would just check the contents of the output file with hdp, I would then use the NAP HDF display utility to have a look at the contents of each file and make sure there is nothing else wrong. Cheers Peter -----Original Message----- From: tcl...@li... [mailto:tcl...@li...] On Behalf Of salah jubeh Sent: Wednesday, 8 March 2006 11:03 PM To: NAP Subject: [Tcl-nap-users] writing HDF files Hi guys =20 I tried to genarate HDF files out of NAOs. =20 set x [nap_get hdf c:/sampels/p14/gdal/p14_4.hdf "3-dimensional Scientific Dataset"] $x hdf sa.hdf sa nap_get hdf -list sa.hdf ------- sa sa:_FillValue I want to ask how i can add SDS to the file like transformation matrix and projection.=20 =20 Regards =20 Yahoo! Mail Use Photomail <http://us.rd.yahoo.com/mail_us/taglines/pmall2/*http://photomail.mail.y ahoo.com> to share photos without annoying attachments. Yahoo! Mail Bring photos to life! New PhotoMail <http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=3D39174/*http://photomai= l .mail.yahoo.com> makes sharing a breeze.=20 |