[Gdal-dev] Gdal and NetCDF...

Daniel Victoria daniel.victoria at gmail.com
Tue Mar 21 13:10:24 EST 2006


Hi all,

I have a very simple python program that subsets and converts the CRU
0.5 degrees time series data in a NetCDF format following COARDS
conventions - hopefully -

Now, I want to convert this NetCDF to TIFF using gdal and import it to
GRASS. When I ask my program to subset the CRU data from 10 to 30
degrees latitude it will get 41 cells from 10.25 to 30.25 (I'm using
cell centers). This means that the data spans from 10 (south edge) to
30.5 (north edge), with 41 cells, which equals 0.5 degrees resolution.

Now, when I do a gdalinfo on the NetCDF file I get a resolution of
0.4878 (equals 20 degrees / 41 cells).

Could someone point me to what I'm doing wrong? Is this a feature/bug?
I'm using GDAL provided by the FWTools-linux-1.0.0a7

I'm attaching the information on the NetCDF file (ncdump and gdalinfo)

Thanks a bunch
Daniel

----- ncdump output -----

netcdf saida {
dimensions:
        X = 41 ;
        Y = 41 ;
        T = 12 ;
variables:
        double Y(Y) ;
                Y:long_name = "Latitude" ;
                Y:units = "degrees_north" ;
        double X(X) ;
                X:long_name = "Longitude" ;
                X:units = "degrees_east" ;
        short T(T) ;
                T:long_name = "Months" ;
                T:units = "months since 1981-01-01" ;
        short pre(T, Y, X) ;
                pre:long_name = "Precipitation" ;
                pre:units = "mm" ;
                pre:scale_factor = 0.1 ;
                pre:missing_value = -9990 ;

// global attributes:
                :Conventions = "COARDS" ;
                :history = "Tyndall Centre grim file created on 13.01.2004 at 14
:28 by Dr. Tim Mitchel" ;
                :production = "CRU TS 2.1 converted to NetCDF by Daniel" ;
data:

 Y = 30.25, 29.75, 29.25, 28.75, 28.25, 27.75, 27.25, 26.75, 26.25, 25.75,
    25.25, 24.75, 24.25, 23.75, 23.25, 22.75, 22.25, 21.75, 21.25, 20.75,
    20.25, 19.75, 19.25, 18.75, 18.25, 17.75, 17.25, 16.75, 16.25, 15.75,
    15.25, 14.75, 14.25, 13.75, 13.25, 12.75, 12.25, 11.75, 11.25, 10.75,
    10.25 ;

 X = 75.25, 75.75, 76.25, 76.75, 77.25, 77.75, 78.25, 78.75, 79.25, 79.75,
    80.25, 80.75, 81.25, 81.75, 82.25, 82.75, 83.25, 83.75, 84.25, 84.75,
    85.25, 85.75, 86.25, 86.75, 87.25, 87.75, 88.25, 88.75, 89.25, 89.75,
    90.25, 90.75, 91.25, 91.75, 92.25, 92.75, 93.25, 93.75, 94.25, 94.75,
    95.25 ;

 T = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ;

<snip> file values...


------ GDAL info output --------
Driver: netCDF/network Common Data Format
Size is 41, 41
Coordinate System is `'
Origin = (75.250000,30.250000)
Pixel Size = (0.48780488,-0.48780488)
Metadata:
  NC_GLOBAL#Conventions=COARDS
  NC_GLOBAL#history=Tyndall Centre grim file created on 13.01.2004 at 14:28 by D
r. Tim Mitchel
  NC_GLOBAL#production=CRU TS 2.1 converted to NetCDF by Daniel
  pre#long_name=Precipitation
  pre#units=mm
  pre#scale_factor=0.1
  pre#missing_value=-9990
  X#long_name=Longitude
  X#units=degrees_east
  Y#long_name=Latitude
  Y#units=degrees_north
  T#long_name=Months
  T#units=months since 1981-01-01
Corner Coordinates:
Upper Left  (  75.2500000,  30.2500000)
Lower Left  (  75.2500000,  10.2500000)
Upper Right (  95.2500000,  30.2500000)
Lower Right (  95.2500000,  10.2500000)
Center      (  85.2500000,  20.2500000)

<snip> band information...




More information about the Gdal-dev mailing list