Closed itati01 closed 1 year ago
The error does not appear with Linux.
Thanks for reporting this @itati01
If you can post more of the stack trace then it may help diagnose your issue.
I have not tried this in a Powershell environment but I was unable to reproduce the error on a Windows 10 machine when running the same command using the versions listed above on the Windows git client bash shell. For example:
$ conda create -n ci_464 python=3.8.12 xarray=0.20.1
$ conda activate ci_464
$ pip install climate_indices
$ git clone git@github.com:monocongo/example_climate_indices.git
$ process_climate_indices --index spei --periodicity monthly \
--netcdf_precip example_climate_indices/example/input/nclimgrid_lowres_prcp.nc --var_name_precip prcp \
--netcdf_pet example_climate_indices/example/input/nclimgrid_lowres_pet.nc --var_name_pet pet \
--output_file_base ../nclimgrid_lowres --scales 9 18 --calibration_start_year 1951 --calibration_end_year 2010 \
--multiprocessing all
2022-03-18 19:48:10 INFO Start time: 2022-03-18 19:48:10.295290
2022-03-18 19:48:10 INFO Computing 9-month SPEI/Pearson
2022-03-18 19:48:35 INFO Computing 9-month SPEI/Gamma
2022-03-18 19:48:58 INFO Computing 18-month SPEI/Pearson
2022-03-18 19:49:26 INFO Computing 18-month SPEI/Gamma
2022-03-18 19:49:50 INFO End time: 2022-03-18 19:49:50.866224
2022-03-18 19:49:50 INFO Elapsed time: 0:01:40.570934
I followed your example and created a new environment and it works. This is the output I receive with the original environment. Maybe there is something with xarray? Do you have any idea why with xr.open_dataset(args.netcdf_precip) as dataset_precip:
works in a test script but not in climate-indices?
2022-03-21 15:19:28 INFO Start time: 2022-03-21 15:19:28.802705
2022-03-21 15:19:28 ERROR Failed to complete
Traceback (most recent call last):
File "C:\Users...\Programme\Anaconda3\envs\indices_env\lib\site-packages\climate_indices__main.py", line 1654, in main
input_type = _validate_args(arguments)
File "C:\Users...\Programme\Anaconda3\envs\indices_env\lib\site-packages\climate_indices__main.py", line 109, in _validate_args
with xr.open_dataset(args.netcdf_precip) as dataset_precip:
File "C:\Users...\Programme\Anaconda3\envs\indices_env\lib\site-packages\xarray\backends\api.py", line 479, in open_dataset
engine = plugins.guess_engine(filename_or_obj)
File "C:\Users...\Programme\Anaconda3\envs\indices_env\lib\site-packages\xarray\backends\plugins.py", line 107, in guess_engine
engines = list_engines()
File "C:\Users...\Programme\Anaconda3\envs\indices_env\lib\site-packages\xarray\backends\plugins.py", line 103, in list_engines
return build_engines(entrypoints)
File "C:\Users...\Programme\Anaconda3\envs\indices_env\lib\site-packages\xarray\backends\plugins.py", line 92, in build_engines
entrypoints = remove_duplicates(entrypoints)
File "C:\Users...\Programme\Anaconda3\envs\indices_env\lib\site-packages\xarray\backends\plugins.py", line 29, in remove_duplicates
selected_module_name = matches[0].module_name
AttributeError: 'EntryPoint' object has no attribute 'module_name'
Traceback (most recent call last):
File "C:\Users...\Programme\Anaconda3\envs\indices_env\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users...\Programme\Anaconda3\envs\indices_env\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users...\Programme\Anaconda3\envs\indices_env\Scripts\process_climate_indices.exe\main.py", line 7, in
Hello, @itati01 is this still an issue for you? I'm not clear as to what the issue is here now since you indicated above that the suggested approach works as advertised for you. I can't surmise what there is in your original environment that is causing the errors you show above, but if still afflicted please give more details.
Hi @monocongo, This issue is not afflicting me and I cannot explore what caused all the trouble. Thank you.
@itati01 I totally appreciate your response. Please don't hesitate to ask if we can help with issues in the future.
Hi, I have two NetCDF with monthly temperature and precipitation from which I would like to derive SPEI. The file may require some further adjustments to be compatible with
process_climate_indices
but the tool currently fails while opening the NetCDFs. The error does not occur in Python (using netCDF4 or xarray). I tested SPEI and PET as well as existing filenames and non-existing filenames.Describe the bug Running
process_climate_indices
results inAttributeError: 'EntryPoint' object has no attribute 'module_name'
thrown byxarray
while opening a NetCDFin _validate_args()
:with xr.open_dataset(args.netcdf_precip) as dataset_precip:
(line 109, line 148)To Reproduce From the documentation: process_climate_indices.exe --index spei --periodicity monthly --netcdf_precip nclimgrid_lowres_prcp.nc --var_name_precip prcp --netcdf_pet nclimgrid_lowres_pet.nc --var_name_pet pet --output_file_base nclimgrid_lowres --scales 9 18 --calibration_start_year 1951 --calibration_end_year 2010 --multiprocessing all
Desktop (please complete the following information):
Additional context Installation in a cloned environment with
python -m pip install climate-indices
Executable run from Anaconda Powershell (and from git bash) Python 3.8.12 climate-indices 1.0.10 xarray 0.20.1