monocongo / climate_indices

Climate indices for drought monitoring
https://monocongo.github.io/climate_indices/
Other
350 stars 167 forks source link

Invalid dimensions error caused by ERA5-Land's dimension `expver` #543

Closed JustinTrvz closed 8 months ago

JustinTrvz commented 8 months ago

Describe the bug ERA5 uses a dimension called expver to mark their products. The problem is that this dimension is not allowed using your tool.

ValueError: Invalid dimensions of the temperature variable: ('time', 'expver', 'latitude', 'longitude')
(valid dimension names and order: [[('lat', 'lon', 'time'), ('time', 'lat', 'lon')], [('time', 'division'), ('division', 'time')]]

To Reproduce Steps to reproduce the behavior:

  1. Download 2m_temperature ERA5-Land Reanalysis dataset from Copernicus.
  2. Execute process_climate_indices --index pet --periodicity monthly --netcdf_temp era5_file.nc --var_name_temp t2m --output_file_base output/pet --calibration_start_year 2014 --calibration_end_year 2023.

Expected behavior PET should be calculated.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context \/

JustinTrvz commented 8 months ago

cdo --reduce_dim -copy in.nc out.nc did the trick! EDIT: Actually it did not help...

bennyistanto commented 7 months ago

If you only using --reduce_dim then you will lost your last month data which categorized as near-real time.

I understand this is already closed issue, but I hope others will get some insight from this issue comments thread. This is from my Notes,app, I documented the way how I solved, but for Precipitation data using the same ERA5-Land.

-- I also experience this issue. As for now (Mar 2023) the data with expver dimension only available in Dec 2022, with expver=1 is final (1 Dec 2022) and expver=5 is near real-time (2-31 Dec 2022).

Let say from https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-land?tab=form I have downloaded daily precipitation data at 00:00 for December 2022, and I got data_202212.nc

I did the following step:

# reduce the expver dimension
cdo --reduce_dim -sellevel,1 data_202212.nc data_202212_expver1.nc
cdo --reduce_dim -sellevel,5 data_202212.nc data_202212_expver5.nc
# get only for 1 Dec as other date is no data
cdo seldate,2022-12-01 data_202212_expver1.nc data_202212_expver1_a.nc
# delete date with 1 Dec
cdo -delete,month=12,day=1 data_202212_expver5.nc data_202212_expver5_a.nc
# merge together
cdo mergetime data_202212_expver1_a.nc data_202212_expver5_a.nc data_202212_final.nc

After this process, you will get the final dimemsion time,lat,lon and ready to merge with previous data range.

monocongo commented 7 months ago

You're a rock star, @bennyistanto Thanks a lot for this!