[gdal-dev] increment in GMT output

Joaquim Luis jluis at ualg.pt
Wed Nov 4 20:19:58 EST 2009


Sebastian,

There is actually more than one error here. Besides the negative y_inc 
the row/columns info is also wrong.
Note for instances the X info

x_min: 0 x_max: 1216 x_inc: 1 name: meters nx: 1216

Either x_min should be 1 OR x_max = 1215.

Joaquim Luis


> Hi,
>
> I translated a HDF image:
>
> $ gdalinfo asi-n6250-20020619-v5i.hdf 
> Driver: HDF4Image/HDF4 Dataset
> Files: asi-n6250-20020619-v5i.hdf
> Size is 1216, 1792
> Coordinate System is `'
> Metadata:
>   valid_range=0, 1
>   long_name=ASI Ice Concentration, 20020619, res: 6.25000, AMSR-E, ASI Version: 5.5i, missing data interpolated.
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0, 1792.0)
> Upper Right ( 1216.0,    0.0)
> Lower Right ( 1216.0, 1792.0)
> Center      (  608.0,  896.0)
> Band 1 Block=1216x82 Type=Float32, ColorInterp=Gray
>
>
> to GMT format with:
>
> $ gdal_translate -of 'GMT' -a_srs 'EPSG:3411' asi-n6250-20020619-v5i.hdf asi-n6250-20020619-v5i.grd
> Warning 6: A dataset opened by GDALOpenShared should have the same filename (asi-n6250-20020619-v5i.hdf) and description (HDF4_SDS:UNKNOWN:"asi-n6250-20020619-v5i.hdf":0)
> Input file size is 1216, 1792
>
> What is the warning about and how can I address it?
>
> The output GMT grid is not valid because it has incorrect y spacing:
>
> $ grdinfo asi-n6250-20020619-v5i.grd 
> grdinfo: GMT ERROR: grid y increment <= 0.0
> grdinfo: Use grdedit -A on your grid file to make region and increments compatible [asi-n6250-20020619-v5i.grd]
> asi-n6250-20020619-v5i.grd: Title: 
> asi-n6250-20020619-v5i.grd: Command: 
> asi-n6250-20020619-v5i.grd: Remark: 
> asi-n6250-20020619-v5i.grd: Pixel node registration used
> asi-n6250-20020619-v5i.grd: Grid file format: cf (# 10) GMT netCDF format (float) (deprecated)                  
> asi-n6250-20020619-v5i.grd: x_min: 0 x_max: 1216 x_inc: 1 name: meters nx: 1216
> asi-n6250-20020619-v5i.grd: y_min: 1792 y_max: 0 y_inc: -1 name: meters ny: 1792
> asi-n6250-20020619-v5i.grd: z_min: 0 z_max: 1 name: meters
> asi-n6250-20020619-v5i.grd: scale_factor: 1 add_offset: 0
>
> However, running `grdedit' as suggested didn't correct the problem, and
> the program kept the -1 y increment.
>
> Any pointers would be appreciated.  Thanks.
>
> Cheers,
>
>   



More information about the gdal-dev mailing list