[Gdal-dev] Another NetCDF driver bug fix

Frank Warmerdam warmerdam at pobox.com
Wed Oct 17 18:27:23 EDT 2007


Joaquim Luis wrote:
> Hi,
> 
> Although there is no track ticked assigned to it, it has been often 
> referred here the problem of the
> netCDF up-down flipping (and Surfer grids btw).
> 
> The problem is that SetProjection() in netcdfdataset.cpp assumes the Y 
> coordinates vector is given
> in descending order. So line nº 1087 (todays - 17-10-2007 svn version)
> 
>            poDS->adfGeoTransform[5] = (( pdfYCoord[ydim-1] -
>                          pdfYCoord[0] ) /
>                        ( poDS->nRasterYSize - 1 ));
> 
> and line 1098
>                  poDS->adfGeoTransform[3] = pdfYCoord[0]
>                      - (poDS->adfGeoTransform[5] / 2);
> 
> are expected to give a negative dy and the top left point.
> 
> However, the most common practice for Y orientation is increasing from 
> bottom to top and not
> the other way around.
> To correct this problem one can add,  after line  1089
>            if ( poDS->adfGeoTransform[5] > 0 )
>             poDS->adfGeoTransform[5] *= -1;
> 
> which will work for both Y orientations
> 
> This corrects for the bad Upper Left when Y "grows up", but I here don't 
> know a solution that works
> for both Y orientation cases.
> 
>                  poDS->adfGeoTransform[3] = pdfYCoord[ydim-1]
>                      - (poDS->adfGeoTransform[5] / 2);
> 
> 
> A related note. With the risk of looking impatient (which I am) this 
> netCDF driver bugs are trailing
> for such a long time. Can't they be killed once for all?

Joaquim,

I believe we need someone to step up and take ownership of the netcdf
driver.  It seems that Denis Nadeau does not have the time to do a lot of
new work on it, and I have been trying to duck these issues.  Are you
interested in taking on responsibility for it?

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list