Changes between Initial Version and Version 3 of Ticket #1505


Ignore:
Timestamp:
Mar 26, 2007, 12:19:25 PM (17 years ago)
Author:
warmerdam
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1505 – Description

    initial v3  
    1 {{{
    21This issue was initially posted on the gdal-dev mailing list using GDAL 1.3.2 (see http://lists.maptools.org/pipermail/gdal-dev/2006-October/010393.html for original message and netCDF file attachment). I am experiencing the same behaviour in GDAL 1.4.0 under Cygwin WinXPSP2.
    32
    43My netCDF file was generated using NCO (ncra), and now I need to convert the NetCDF file into a different format for GIS programs:
     4{{{
    55$ gdal_translate -of AAIGrid -sds test.nc test.asc
    66$ mv test.asc1 test.asc
     7}}}
    78No errors were generated during the conversion.
    89
    910The header of the AAIGrid output is:
     11{{{
    1012ncols        86
    1113nrows        225
     
    1517dy           99.555555555556
    1618NODATA_value  -9999
    17 
     19}}}
    1820However, these headers should read:
     21{{{
    1922ncols         86
    2023nrows         225
     
    2326cellsize      100
    2427NODATA_value  -9999
     28}}}
    2529
    2630The dx/dy in the output of the file was incorrectly calculated as:
     31{{{
    2732dx=cellsize*(ncol-1)/ncol
    2833dy=cellsize*(nrow-1)/nrow
     34}}}
    2935
    3036theses formulas are of course nonsense, but are apparently how they were calculated. This is also why dx != dy (because ncols != nrows), and why they are not correct, since they are multiplied by the ratio of base0/base1 representations of their dimension lengths.
     
    3339
    3440(As a caution, I have also seen some netCDF files which order their latitudes from North to South, which is also in reverse order; I'm not sure if this is tested, and corrected in GDAL, but I would highly advise it for netCDF files).
    35 }}}