RE: [Tcl-nap-users] writing HDF files
Brought to you by:
dav480,
peter_turner
From: salah j. <s_...@ya...> - 2006-03-10 09:47:48
|
Hi Peter 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. Today i test the result of this code with gdalinfo tool 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" The too images suppose to be identical but the result was not as i expected. 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 = 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",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 = (477701.230832,3928005.705781) Pixel Size = (0.63939200,-0.63939200) Metadata: Signature=Created with GDAL (http://www.remotesensing.org/gdal/) TransformationMatrix=477701.230832, 0.639392, 0.000000, 3928005.705781, 0.0000 00, -0.639392 Projection=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 = 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 78137,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_eastin g",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"] ]] AREA_OR_POINT=Area TIFFTAG_SOFTWARE=IMAGINE 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=1 TIFFTAG_YRESOLUTION=1 TIFFTAG_RESOLUTIONUNIT=1 (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=615x1 Type=UInt16, ColorInterp=Gray The result image information " test.hdf" 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=477701.230832, 0.639392, 0.000000, 3928005.705781, 0.0000 00, -0.639392 Projection=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 = 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 78137,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_eastin g",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"] ]] AREA_OR_POINT=Area TIFFTAG_XRESOLUTION=1 TIFFTAG_YRESOLUTION=1 TIFFTAG_RESOLUTIONUNIT=1 (unitless) _FillValue=65535 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=615x1 Type=UInt16, ColorInterp=Gray 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 I want to ask why this happen, how can i create anew image have the same meta data but diffrent cell values. Pet...@cs... wrote: Hi salah, You seem to have sorted out how to write multiple SDSs and attributes. 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 = [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 I tried to genarate HDF files out of NAOs. 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. Regards Yahoo! Mail Use Photomail to share photos without annoying attachments. --------------------------------- Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. |