[gdal-dev] near identical files being treated differently

Ken Mankoff mankoff at gmail.com
Mon Jan 23 04:46:15 PST 2023


Hello,

I have two near-identical files available at:

wget https://portal.nccs.nasa.gov/GISS_modelE/modelE_input_data/GLMELT_4X5.OCN.nc

wget https://portal.nccs.nasa.gov/GISS_modelE/modelE_input_data/GLMELT_144X90_gas.OCN.nc

They differ only in their dimensions:

$ diff <(ncdump -h GLMELT_4X5.OCN.nc) <(ncdump -h GLMELT_144X90_gas.OCN.nc)|cat -n
     1  1c1
     2  < netcdf GLMELT_4X5.OCN {
     3  ---
     4  > netcdf GLMELT_144X90_gas.OCN {
     5  3,4c3,4
     6  <       lon = 72 ;
     7  <       lat = 46 ;
     8  ---
     9  >       lon = 144 ;
    10  >       lat = 90 ;


However, "galinfo" sees them differently, and therefore they are treated very differently in, for example, QGIS.


$ diff <(gdalinfo GLMELT_4X5.OCN.nc) <(gdalinfo GLMELT_144X90_gas.OCN.nc)|cat -n
     1  2,3c2,6
     2  < Files: GLMELT_4X5.OCN.nc
     3  < Size is 72, 46
     4  ---
     5  > Files: GLMELT_144X90_gas.OCN.nc
     6  >        GLMELT_144X90_gas.OCN.nc.aux.xml
     7  > Size is 144, 90
     8  > Origin = (-180.000000000000000,90.000000000000000)
     9  > Pixel Size = (2.500000000000000,-2.000000000000000)
    10  8,13c11,18
    11  < Upper Left  (    0.0,    0.0)
    12  < Lower Left  (    0.0,   46.0)
    13  < Upper Right (   72.0,    0.0)
    14  < Lower Right (   72.0,   46.0)
    15  < Center      (   36.0,   23.0)
    16  < Band 1 Block=72x1 Type=Float32, ColorInterp=Undefined
    17  ---
    18  > Upper Left  (-180.0000000,  90.0000000) 
    19  > Lower Left  (-180.0000000, -90.0000000) 
    20  > Upper Right ( 180.0000000,  90.0000000) 
    21  > Lower Right ( 180.0000000, -90.0000000) 
    22  > Center      (   0.0000000,   0.0000000) 
    23  > Band 1 Block=144x1 Type=Float32, ColorInterp=Undefined
    24  >   Min=0.000 Max=1.000 
    25  >   Minimum=0.000, Maximum=1.000, Mean=0.018, StdDev=0.134
    26  16a22,25
    27  >     STATISTICS_MAXIMUM=1
    28  >     STATISTICS_MEAN=0.018364197530864
    29  >     STATISTICS_MINIMUM=0
    30  >     STATISTICS_STDDEV=0.13426449188044


That is, the larger file contains key info:

Origin = (-180.000000000000000,90.000000000000000)
Pixel Size = (2.500000000000000,-2.000000000000000)

Which then generates correct Corner Coordinates.

Given that the 'ncdump' of the two files is identical (except size), can someone clarify what I'm doing wrong here?

Thanks,

  Ken Mankoff


More information about the gdal-dev mailing list