Insert a single Lat and Lon point to NETCDF
Added by Rodrigo Sousa over 3 years ago
Hello,
I can currently extract a single point from a netcdf with:
cdo -outputtab,date,lon,lat,value -remapnn,"lon=9.0_lat=54.0" infile.nc > output.csv
I was wondering if I can do the opposite.
Insert a single point in netcdf, for example:
lon=9
lat=54
precipitation=25
Is that possible in CDO?
Replies (2)
RE: Insert a single Lat and Lon point to NETCDF - Added by Karin Meier-Fleischer over 3 years ago
Hi Rodrigo,
the operator setclonlatbox can change the data values of a single cell or a subregion. It is a little bit tricky to change the value for a single point location because you have to set a range where the point is the center of it.
Create test data:
cdo -f nc -topo topo.nc
Show the value at lon=0.0/lat=0.0:
cdo -infon -remapnn,"lon=0.0_lat=0.0" topo.nc cdo(1) remapnn: Process started -1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name cdo(1) remapnn: Nearest neighbor weights from lonlat (720x360) to lonlat (1x1) grid 1 : 0000-00-00 00:00:00 0 1 0 : -4947.0 : topo
Change the value at position lon=0.0 / lat=0.0 to 100000:
cdo -setclonlatbox,100000,-0.25,0.25,-0.25,0.25 topo.nc outfile.nc
Let's see the result:
cdo -infon -remapnn,"lon=0.0_lat=0.0" outfile.nc cdo(1) remapnn: Process started -1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name cdo(1) remapnn: Nearest neighbor weights from lonlat (720x360) to lonlat (1x1) grid 1 : 0000-00-00 00:00:00 0 1 0 : 1.0000e+05 : topo cdo(1) remapnn: Processed 259200 values from 1 variable over 1 timestep.
-Karin
RE: Insert a single Lat and Lon point to NETCDF - Added by Rodrigo Sousa over 3 years ago
Hi Karin.
It was a question that I thought and wanted to know if I had how to do it in CDO.
I'll try this procedure.
Thanks.