I have also had an issue with the geotransform being of by a factor of 1000, but it was a units issue. GDAL kind of assumes CF=1.x convention, as netcdf is very broad in its specification. Could you attach a small sample dataset to a ticket so I can take a look? Thanks.
kss # ============================ Kyle Shannon Physical Science Technician RMRS Fire Sciences Lab Fire, Fuels & Smoke - RWU 4405 5775 Highway 10 W. Missoula, MT 59808 (406)829-6954 [email protected] # ============================ On Thu, May 20, 2010 at 8:37 PM, Ole Nielsen <[email protected]> wrote: > > Dear GDAL developers > > I have been using GDAL for a while with great success and really appreciate > the toolkit. > As of recently, I now have the need to read NetCDF files and convert them > into AAIGRIDs. However, the cellsize is wrong and I don't think xllcorner > and yllcorner are correct either. > > I have searched this forum and I think this may be related to the thread > named "[gdal-dev] netcdf to geotiff and aaigrid" from 2008. However, I > didn't find a resolution in that thread - hence this posting. > > The content of the NetCDF file is obtained by running ncdump merapi.res.nc > : > > netcdf merapi.res { > dimensions: > x = 59 ; > y = 64 ; > alt = 6 ; > time = UNLIMITED ; // (4 currently) > variables: > float x(x) ; > x:units = "m" ; > x:description = "UTM. West-East distance" ; > float y(y) ; > y:units = "m" ; > y:description = "UTM. South-North distance" ; > .... (many lines removed here) > data: > > x = 412432.3, 413449.5, 414466.8, 415484, 416501.2, 417518.5, 418535.7, > 419553, 420570.2, 421587.4, 422604.7, 423621.9, 424639.1, 425656.4, > 426673.6, 427690.8, 428708.1, 429725.3, 430742.6, 431759.8, 432777, > 433794.2, 434811.5, 435828.7, 436846, 437863.2, 438880.4, 439897.7, > 440914.9, 441932.2, 442949.4, 443966.6, 444983.8, 446001.1, 447018.3, > 448035.6, 449052.8, 450070, 451087.3, 452104.5, 453121.8, 454139, > 455156.2, 456173.5, 457190.7, 458207.9, 459225.2, 460242.4, 461259.6, > 462276.9, 463294.1, 464311.3, 465328.6, 466345.8, 467363.1, 468380.3, > 469397.5, 470414.8, 471432 ; > > y = 9106709, 9107724, 9108740, 9109756, 9110772, 9111788, 9112804, > 9113820, > 9114836, 9115851, 9116867, 9117883, 9118899, 9119915, 9120931, 9121947, > 9122962, 9123978, 9124994, 9126010, 9127026, 9128042, 9129058, 9130073, > 9131089, 9132105, 9133121, 9134137, 9135153, 9136169, 9137185, 9138200, > 9139216, 9140232, 9141248, 9142264, 9143280, 9144296, 9145311, 9146327, > 9147343, 9148359, 9149375, 9150391, 9151407, 9152422, 9153438, 9154454, > 9155470, 9156486, 9157502, 9158518, 9159534, 9160549, 9161565, 9162581, > 9163597, 9164613, 9165629, 9166645, 9167660, 9168676, 9169692, 9170708 ; > > ...... (lines removed) > > TOPOGRAPHY = > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51.99445, > 124.9918, 103.0026, 170.9917, 191.9973, 183.0012, 214.9956, 215, > 204.0016, 246.9934, 231.0025, 221.0016, 226.999, 224.0005, 249.9954, > 211.0071, 232.9959, 242.9981, 224.0038, 231.9984, 222.0021, 240.9959, > 271.9932, 265.0016, 284.9954, 286.9995, 289.9993, 293.999, 311.9955, > 274.0097, 294.9946, 282.0034, 302.9944, 317.9959, 311.002, 314.9989, > 330.9954, 338.9977, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105.9893, 183.9907, > 183.9983, 189.9981, 199.9982, 200.999, 215.9977, 224.9986, 217.0007, > 264.993, 260.0003, 273.9973, 246.0043, 249.9992, 291.9925, 299.998, > 300.9991, 277.004, 256.0034, 272.9964, 252.004, 246.001, 243.0005, > 256.9968, 242.0032, 268.9941, 253.0037, 249.0013, 272.9945, 271.0006, > 277.9984, 263.0042, 266.9991, 277.9973, 312.9904, 322.9971, 295.0079, > 295.0002, 273.0067, 336.9814, 334.0009, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96.98979, 189.9899, > 180.001, 205.9969, 205.9997, 213.9988, 236.9966, 240.999, 255.9975, > ...... etc etc > > ======================== > > The command I use to extract this topography variable is > gdal_translate -of AAIGrid NETCDF:"merapi.res.nc":TOPOGRAPHY > merapi.topography.asc > > and the header of the resulting file is > ncols 59 > nrows 64 > xllcorner 0.000000000000 > yllcorner -64.000000000000 > cellsize 1.000000000000 > NODATA_value 9.9692099683868690468e+36 > 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 > 51.99444 > 9615478515625 124.9918365478515625 103.00257110595703125 170.99169921875 > 191.9973297119140625 183.001190185546875 214.99560546875 215 > 204.001617431640625 > 246.993438720703125 231.0025177001953125 ........ > > --------------------------------------------------------- > > I do not understand why the cellsize is 1.000000 when it should be in the > order of 1000. > Also, I do not understand why xllcorner and yllcorner aren't obtained as > e.g. the minimum values of the x and y vectors. > > The version of gdal-bin is 1.5.2-3ubuntu1 and my platform is Ubuntu 9.04 > (64 > bit). > > By the way, trying to contour directly from the NetCDF puts all the > contours at the south pole. I suspect this is another manifestation of the > origins being ignored. > > Can anyone help please? > > Cheers and thanks > Ole Nielsen > > > -- > View this message in context: > http://osgeo-org.1803224.n2.nabble.com/gdal-translate-netcdf-to-aaigrid-wrong-cellsize-xllcorner-and-yllcorner-tp5073995p5073995.html > Sent from the GDAL - Dev mailing list archive at Nabble.com. > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev >
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
