climate_indices icon indicating copy to clipboard operation
climate_indices copied to clipboard

ValueError: the first argument to .drop_sel must be a dictionary"

Open mjh1366 opened this issue 2 years ago • 12 comments

How to craft a useful, minimal bug report

I'm using the PyPi version of climate indices with input datasets in climate-indices' package: nclimgrid_lowres_prcp.nc

I'm getting this Error" raise ValueError(f"the first argument to .{func_name} must be a dictionary") ValueError: the first argument to .drop_sel must be a dictionary"

Describe the bug

    **raise ValueError(f"the first argument to .{func_name} must be a dictionary")
ValueError: the first argument to .drop_sel must be a dictionary**

To Reproduce

Steps to reproduce the behavior:

1. conda create -n indices_env
2. activate indices_env
3. pip install climate-indices
4. pip install -r requirements.txt
5. pip-compile -o requirements.txt pyproject.toml
6. conda install -c conda-forge nco
7. pip install netcdf4
8. pip install h5netcdf
  1. (env1) E:\climate\climate_indices-master\input>process_climate_indices --index spi --periodicity monthly --netcdf_precip ./nclimgrid_lowres_prcp.nc --var_name_precip prcp --output_file_base ../output/nclimgrid_lowres --scales 6 12 --calibration_start_year 1951 --calibration_end_year 2010 --multiprocessing all
2023-01-10  19:53:33 INFO Start time:    2023-01-10 19:53:33.396280
2023-01-10  19:53:33 INFO Computing 6-month SPI/Pearson
2023-01-10  19:53:33 ERROR Failed to complete
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\site-packages\climate_indices\__main__.py", line 1708, in main
    _compute_write_index(kwrgs)
  File "C:\Program Files\Python310\lib\site-packages\climate_indices\__main__.py", line 809, in _compute_write_index
    _drop_data_into_shared_arrays_grid(dataset,
  File "C:\Program Files\Python310\lib\site-packages\climate_indices\__main__.py", line 637, in _drop_data_into_shared_arrays_grid
    dataset = dataset.drop_sel(var_name)
  File "C:\Program Files\Python310\lib\site-packages\xarray\core\dataset.py", line 4486, in drop_sel
    labels = either_dict_or_kwargs(labels, labels_kwargs, "drop_sel")
  File "C:\Program Files\Python310\lib\site-packages\xarray\core\utils.py", line 286, in either_dict_or_kwargs
    raise ValueError(f"the first argument to .{func_name} must be a dictionary")
ValueError: the first argument to .drop_sel must be a dictionary
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python310\Scripts\process_climate_indices.exe\__main__.py", line 7, in <module>
  File "C:\Program Files\Python310\lib\site-packages\climate_indices\__main__.py", line 1708, in main
    _compute_write_index(kwrgs)
  File "C:\Program Files\Python310\lib\site-packages\climate_indices\__main__.py", line 809, in _compute_write_index
    _drop_data_into_shared_arrays_grid(dataset,
  File "C:\Program Files\Python310\lib\site-packages\climate_indices\__main__.py", line 637, in _drop_data_into_shared_arrays_grid
    dataset = dataset.drop_sel(var_name)
  File "C:\Program Files\Python310\lib\site-packages\xarray\core\dataset.py", line 4486, in drop_sel
    labels = either_dict_or_kwargs(labels, labels_kwargs, "drop_sel")
  File "C:\Program Files\Python310\lib\site-packages\xarray\core\utils.py", line 286, in either_dict_or_kwargs
    **raise ValueError(f"the first argument to .{func_name} must be a dictionary")
ValueError: the first argument to .drop_sel must be a dictionary**

Expected behavior A clear and concise description of what you expected to happen.

Screenshots

Desktop (please complete the following information):

  • win-64
  • 10

Additional context Add any other context about the problem here.

mjh1366 avatar Jan 10 '23 17:01 mjh1366