settaxis change grid
Added by Guido Fioravanti about 7 years ago
Hi,
I have noticed that the grid of my netCDF files changes after setting the time axis (cdo settaxis). My input files are ERA5 reanalysis reprojected to a UTM grid (epsg 32632) using
the R raster package. These files are perfectly aligned to my reference grid for Italy, while a slight shift is apparent after setting their time axis with cdo.
Why? I would expect the grid not to change with the temporal axis.
Regards,
Guido
Replies (7)
RE: settaxis change grid - Added by Karin Meier-Fleischer about 7 years ago
Hi Guido,
can you upload a test file and the cdo command you are using.
-Karin
RE: settaxis change grid - Added by Guido Fioravanti about 7 years ago
Hi,
now I upload the images of my netCDF files before and after using the command:
cdo settaxis,2015-01-01,00:00:00,1days dust_it_utm.nc dust_it_utm_settaxis.nc
The yellow raster (newtCDF file, epsg 32632 from R raster package) perfectly fits my reference grid for Italy. Unfortunately, the R raster package cannot set the time axis. At this purpose I use cdo (command above).
After setting the time axis is apparent a slight shift in my grid (in the second picture you can see both the yellow, pre-settaxis, and black, post-settaxis, grids, while it should be visible only the black grid overlaying the yellow one).
Thanks
Guido
RE: settaxis change grid - Added by Guido Fioravanti about 7 years ago
Here are two files,
the one before settaxis and the one after cdo settaxis.
The original files have 365 timestamps but they are too big to upload.
Guido
esempio.nc (29.4 MB) esempio.nc | file before settaxis | ||
esempio_settaxis.nc (29.4 MB) esempio_settaxis.nc | after settaxis |
RE: settaxis change grid - Added by Karin Meier-Fleischer about 7 years ago
There is no correct time dimension in the esempio.nc file. The variable z has to be changed to time and the units to "days since 2015-01-01 00:00:00". Those operations can't be done by CDO but NCO can do it.
Rename the dimension z to time
ncrename -O -d z,time -v z,time $infile tmp.nc
Change attributes of time
ncatted -O -a units,time,o,c,"days since 2015-01-01 00:00:00" -a long_name,time,o,c,"time" tmp.nc
Now, let CDO do the correct settings for time (e.g. calendar attribute)
cdo settaxis,2015-01-01,,1days tmp.nc outfile.nc
Hope this helps.
-Karin
RE: settaxis change grid - Added by Guido Fioravanti about 7 years ago
Dear Karin,
thanks for your help.
I followed your steps (ncrename -> ncatted -> cdo settaxis) and unfortunately I still have a final output not perfectly aligned with my refrence grid.
The "tmp.nc" file from ncatted fits my grid perfectly, while the outfile.nc from "cdo settaxis" is shifted as in the image I uploaded in my previous post.
Any idea?
Regards,
Guido
RE: settaxis change grid - Added by Karin Meier-Fleischer about 7 years ago
Hi Guido,
I've tested the two files using NCL to read the variables and plot one variable and its grid over the other variable with its grid. The northing and the easting are identical and the variables, too. The plot does not show any difference, too. See attached PNG plot file.
esempio.nc: grid lines - thick blue; the yellow color represent the data. outfile.nc: grid lines - thinner green; the dashed lines represent the data.
Sample Images
-Karin
plot_both.png (88.3 KB) plot_both.png | NCL plot file from variable esempio.nc/outfile.nc |
RE: settaxis change grid - Added by Guido Fioravanti about 7 years ago
Thanks Karin,
actually it seems to be a problem with QGIS.
Nonethelesse, thanks for your help.
Guido