guidocioni / icon_d2

10 stars 5 forks source link

Problems with plot #3

Closed pinuzzz closed 2 months ago

pinuzzz commented 2 months ago

Hi Guido, Thank you for the material you made available! At the beginning I encountered a problem with CDO which asked to put the options contained in the function download file in brackets []: I solved it like this: cdo -f nc copy [ -seltime,00:00,01:00,02:00,03:00,04:00,05:00,06:00,07:00,08:00,09:00,10:00,11:00,12:00,13:00,14:00,15:00,16:00,17:00,18:00,19:00,20:00,21:00,22:00,23:00 -mergetime ${filename} ] ${1}_${year}${month}${day}${run}_de.nc Please tell me if I got it right, thank you! In any case, the .nc files (about 170 mb per file) are produced and no more download errors are reported. The problem is when I go to plot: some variables are not seen and xarray tries to create one, but the whole thing gets stuck `Traceback (most recent call last): File "/home/giuseppe/anaconda3/lib/python3.12/site-packages/xarray/core/dataset.py", line 1336, in _construct_dataarray variable = self._variables[name]


KeyError: 'RAIN_GSP'

Traceback (most recent call last):
  File "/home/giuseppe/Scrivania/icon_d2/computations.py", line 114, in compute_rate
    rain_acc = dset['RAIN_GSP'] + dset['RAIN_CON']`

It doesn't depend on anaconda because even with python direct environment the error is the same
Thanks for your help
guidocioni commented 2 months ago

Hi Guido, Thank you for the material you made available! At the beginning I encountered a problem with CDO which asked to put the options contained in the function download file in brackets []: I solved it like this: cdo -f nc copy [ -seltime,00:00,01:00,02:00,03:00,04:00,05:00,06:00,07:00,08:00,09:00,10:00,11:00,12:00,13:00,14:00,15:00,16:00,17:00,18:00,19:00,20:00,21:00,22:00,23:00 -mergetime ${filename} ] ${1}_${year}${month}${day}${run}_de.nc Please tell me if I got it right, thank you! In any case, the .nc files (about 170 mb per file) are produced and no more download errors are reported. The problem is when I go to plot: some variables are not seen and xarray tries to create one, but the whole thing gets stuck `Traceback (most recent call last): File "/home/giuseppe/anaconda3/lib/python3.12/site-packages/xarray/core/dataset.py", line 1336, in _construct_dataarray variable = self._variables[name] ~~~^^^^^^ KeyError: 'RAIN_GSP'

Traceback (most recent call last): File "/home/giuseppe/Scrivania/icon_d2/computations.py", line 114, in compute_rate rain_acc = dset['RAIN_GSP'] + dset['RAIN_CON']`

It doesn't depend on anaconda because even with python direct environment the error is the same Thanks for your help

yeah i really don't like the new cdo Syntax, I think they made it even more complicated. I don't know if the modification you made is correct or not; a good way to check would be to look at the output files. are all the variables inside? Xarray cannot find RAIN_GSP. either it got lost or it changed the name (really likely with a new grib api version!!)

pinuzzz commented 2 months ago

Hi Guido, thanks for the quick response. I checked and all the files are generated by CDO, so ok. Instead for the plots, I tried to see if the names of the variables have changed and indeed some of them have changed, for example RAIN_GSP has changed to lsrr (large scale rain rate): I tried to change the name in the scripts and in the computations file, but it still gives me the same error Key error lssr. Any ideas? Thanks

pinuzzz commented 2 months ago

ok I got it!!! Must have changed the generated file name to the new variable name! Thanks Guido and have a great summer!