[gdal-dev] Reprojection of HDF data.. again on GCP extraction

Lucena, Ivan ivan.lucena at pmldnet.com
Tue Mar 11 08:48:59 EDT 2008


Mattia,

Instead of AWK, you can use Python to re-organize the content of those 
files. You just need simple text file reading and the string methods 
like split() and then develop you logic to match the two files.

file = open('latitude.dump', 'r')
line = file.readline()
line = line.split()
cell = float(line[1])


You can either prepare the output as a text file to be passed to GDAL 
tools or you can call GDAL API directly in the same Python script.

Best regards,

Ivan

mattia wrote:
> Hello folks,
> 
> I still need some help / advise for reprojecting my HDF raster image
> datasets..
> I manage to dump the "Latitude" and "Longitude" data sets of the HDF file
> into ASCII format...
> Now I would like to use this data to do the reprojection.. The dump I did
> using HDF's hdp utility as follows:
> 
> mattia at mattia-laptop:~/Desktop/data/prove/1$ hdp dumpsds -n Latitude -d -x
> -o latitude AMOD021KM20070104035343.hdf
> mattia at mattia-laptop:~/Desktop/data/prove/1$ hdp dumpsds -n Longitude -d -x
> -o longitude AMOD021KM20070104035343.hdf
> 
> The contents of the file is as follows (Latitude for example):
> 
> 64.731689 64.741600 64.749550 64.755737 64.760345 64.763504 64.765366
> 64.766037 64.765633 64.764244 64.761963 64.758858 64.754997 64.750458
> 64.745285 64.739532 64.733253 64.726479 64.719261 64.711617 64.703606
> 64.695229 64.686531 64.677536 64.668266 64.658737 64.648972 64.638985
> 64.628799 64.618423 64.607880 64.597176 64.586319 64.575333 64.564217
> 64.552979 64.541634 64.530190 64.518654 64.507034 64.495338 64.483559
> 64.471718 64.459816 64.447853 64.435837 64.423767 64.411659 64.399506
> 64.387314 64.375084 64.362823 64.350525 64.338203 64.325851 64.313484
> 64.301086 64.288673 64.276237 64.263779 64.251312 64.238823 64.226318
> 64.213806 64.201271 64.188736 64.176178 64.163612 64.151039 64.138451
> 64.125854 64.113251 64.100639 64.088013 64.075378 64.062737 64.050079
> 64.037415 64.024742 64.012062 63.999371 63.986668 63.973953 63.961227
> 63.948494 63.935745 63.922985 63.910213 63.897430 63.884628 63.871819
> 63.858990 63.846146 63.833290 63.820412 63.807522 63.794609 63.781685
> 63.768738 63.755768 63.742779 63.729767 63.716736 63.703678 63.690601
> 63.677494 63.664364 63.651207 63.638020 63.624805 63.611561 63.598286
> 63.584984 63.571644 63.558270 63.544861 63.531418 63.517937 63.504421
> 63.490864 63.477264 63.463623 63.449940 63.436214 63.422440 63.408619
> 63.394753 63.380836 63.366871 63.352848 63.338776 63.324650 63.310463
> 63.296223 63.281918 63.267559 63.253132 63.238644 63.224091 63.209465
> 63.194775 63.180012 63.165180 63.150269 63.135284 63.120224 63.105080
> 63.089855 63.074547 63.059151 63.043671 63.028099 63.012436 62.996674
> 62.980820 62.964863 62.948811 62.932648 62.916386 62.900009 62.883526
> 62.866928 62.850208 62.833378 62.816418 62.799339 62.782131 62.764790
> 62.747314 62.729702 62.711952 62.694057 62.676014 62.657822 62.639477
> 62.620972 62.602303 62.583473 62.564472 62.545296 62.525944 62.506409
> 62.486687 62.466774 62.446667 62.426357 62.405842 62.385117 62.364174
> 
> .
> .
> .
> etc
> .
> .
> .
> 
> 
> 
> 
> Now, I need to construct GCPs from this data and I would just like to know
> what would be best..
> 
> 1) writing a C utility which does the job and prepares GCPs which later I
> can pass to gdal_translate from a file for example
> 
> 2) A C utility which creates the GCPs and a VRT file with these included for
> the later coming reprojection
> 
> Any other ideas would be appreciated..
> 
> The problem is though how to assign the actual GCPs...  I mean, every GCP
> has format (x,y) > (lat,long) ..   how do I know how to assign the (x,y)
> part??
> 
> 
> Regards
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list