Closed mhadizadeh91 closed 2 years ago
I changed 'time' to double type and gave all variables corresponding '_FillValue' but ultimately I received new error:
2021-09-14 19:07:27,682 **** 2021-09-14 19:07:27,682 2021-09-14 19:07:27,683 icclim V4.2.19 2021-09-14 19:07:27,683 2021-09-14 19:07:27,683 2021-09-14 19:07:27,683 Tue Sep 14 19:07:27 2021 GMT 2021-09-14 19:07:27,683 2021-09-14 19:07:27,683 BEGIN EXECUTION 2021-09-14 19:07:27,684 2021-09-14 19:07:27,684 **** Traceback (most recent call last): File "test.py", line 6, in
icclim.indice(user_indice=my_indice_params, in_files=file_tas, var_name='tas', slice_mode='year', out_unit='days', out_file=out_f, callback=callback.defaultCallback2) File "/home/mostafa/Bijandi_thesis/icclim/icclim/icclim.py", line 175, in indice indice_dim = util_nc.copy_var_dim(inc, onc, var_name[0], lev_dim_pos=lev_dim_pos) # tuple ('time', 'lat', 'lon')
File "/home/mostafa/Bijandi_thesis/icclim/icclim/util/util_nc.py", line 250, in copy_var_dim onc_dim0.setattr(attr[0], attr[1]) File "src/netCDF4/_netCDF4.pyx", line 4309, in netCDF4._netCDF4.Variable.setattr AttributeError: _FillValue attribute must be set when variable is created (using fill_value keyword to createVariable)
Also my ncdump is as follow:
$ ncdump -h 2002-T2max.nc
netcdf \2002-T2max { dimensions: time = 366 ; lat = 121 ; lon = 121 ; variables: double time(time) ; time:axis = "T" ; time:calendar = "proleptic_gregorian" ; time:long_name = "time" ; time:standard_name = "time" ; time:stored_direction = "increasing" ; time:type = "double" ; time:units = "days since 2000-01-01 00:00:00" ; time:_FillValue = -9.99999979021477e+33 ; int64 realization ; realization:long_name = "realization" ; realization:units = "1" ; realization:standard_name = "realization" ; realization:stored_direction = "increasing" ; realization:type = "integer" ; realization:_FillValue = -999 ; double lat(lat) ; lat:units = "degrees_north" ; lat:standard_name = "latitude" ; lat:long_name = "latitude" ; lat:stored_direction = "decreasing" ; lat:axis = "Y" ; lat:positive = "up" ; lat:type = "double" ; lat:valid_max = 90. ; lat:valid_min = -90. ; lat:_FillValue = -9.99999979021477e+33 ; double lon(lon) ; lon:units = "degrees_east" ; lon:standard_name = "longitude" ; lon:long_name = "longitude" ; lon:axis = "X" ; lon:positive = "up" ; lon:type = "double" ; lon:valid_max = 360. ; lon:valid_min = -180. ; lon:_FillValue = -9.99999979021477e+33 ; float tas(time, lat, lon) ; tas:long_name = "Near-Surface Air Temperature" ; tas:units = "K" ; tas:standard_name = "air_temperature" ; tas:comment = "near-surface (usually, 2 meter) air temperature" ; tas:cds_magics_style_name = "near-surface-air-temperature" ; tas:type = "real" ; tas:coordinates = "realization" ; tas:_FillValue = 1.e+36f ;
// global attributes: :Conventions = "CF-1.7" ; :institution = "European Centre for Medium-Range Weather Forecasts" ; :source = "ECMWF" ; :nco_openmp_thread_number = 1 ;
Edited file has been attached 2002-T2max.zip .
I have check the file.
It seems that the netcdf-python does not support int64. Also _FillValue for a coordinate variable is not supported. So what I did to make it work was to:
With icclim 5.0.0 the copying of variable dimension is no longer done directly by icclim but instead we let xarray handle this kind of work. I'm closing this because if the issue still exist the error will be very different.
Hi dear, I've got the following error when I want to run the code in the below:
import icclim
from icclim.util import callback
my_indice_params = {'indice_name': 'my_indice', 'calc_operation': 'nb_events', 'logical_operation': 'lt', 'thresh': 0 + 273.15 } file_tas = "/home/2002-T2max.nc"
out_f = "my_indice.nc"
icclim.indice(user_indice=my_indice_params, in_files=file_tas, var_name='tas', slice_mode='year', out_unit='days', out_file=out_f, callback=callback.defaultCallback2)
Also ncdump result is as follow:
$ ncdump -h ../2002-T2max.nc
Also my netcdf file has been attached.
2002-T2max.zip
Cheers,