csv lat,lon,value to AAIGrid : CDO versus GDAL
Added by Christophe LOZAC'H over 1 year ago
Hello,
First I am a complete beginner in cdo.
But, here is a CSV file with columns id, x, y, z (where x = lon, y = lat). I want to convert it to an AAIgrid format. Gdal should be able to do this, but it's telling me that the grid is irregular. However, all points are aligned in rows and columns. I could use gdal_grid, but I don't want to interpolate any missing values.
I'm wondering if cdo is more powerful than gdal in solving this problem?
Here are my failed gdal commands:
xmin=1617923.94
ymin=8142996.42
xmax=1679923.94
ymax=8211996.42
$f=p.csv
gdalbuildvrt -a_srs EPSG:4326 -separate -overwrite -srcnodata "-999.0" build.vrt $f
gdalwarp -of VRT -ot Int32 -s_srs epsg:4326 t_srs epsg:3949 -te $xmin $ymin $xmax $ymax -tr 1000 -1000 -srcnodata -999.0 -dstnodata -9999 build.vrt test.vrt
gdal_translate -of AAIGrid -ot Int32 -co DECIMAL_PRECISION=5 test.vrt result.grd
Many thanks
Replies (2)
RE: csv lat,lon,value to AAIGrid : CDO versus GDAL - Added by Karin Meier-Fleischer over 1 year ago
Hi Christophe,
because we are not experts for GDAL we can't help here. The AAIgrid format description (https://gdal.org/drivers/raster/aaigrid.html) says it is a special ASCII format and this format can't be exported by CDO. CDO can write e.g. 'normal' ASCII files, GRIB, and netCDF. See https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#subsection.1.2.1
RE: csv lat,lon,value to AAIGrid : CDO versus GDAL - Added by Christophe LOZAC'H over 1 year ago
Thank you for this answer which specifies the scope of use of CDO
Regards