-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: the first argument to .drop_sel must be a dictionary" #495
Comments
A new version is available now via PyPI, please advise if you still have this or any other issues with the latest version there. Thanks! |
Thanks for your consideration. Now If I use input datasets in climate-indices' package, there will be no problem:
But if I use my input datasets, the same problem will occur:
I upload my input datasets here: Monthly precipitation data from CORDEX SouthAsia- model remoo2009 |
This results from the file being written by CDO which defaults to using the time dimension as the outermost for the data variables. This package's processing script expects variables with dims = (lat, lon, time) instead. This used to be performed in the script itself but NCO is buggy on Windows and many users reported issues, so we recently removed that from this script. We need to document this better to make users aware that they need to re-orient the data variables to (lat, lon, time) otherwise this will happen. Also BTW, the file you are using does not have units for the precip variable, which also causes an error. This removal of NCO support should cause a new version since this breaks things for some users. Thanks for bringing this to my attention, @mjh1366 |
BTW I misspoke above, the order is off in that file but that wasn't the bug. xarray.Dataset.drop_sel() takes a list and instead the code drops a single variable at a time. I have a fix ready for PR soon, stay tuned... |
Thank you so much.
Thanks for your consideration, @monocongo |
We received "ValueError: the first argument to .drop_sel must be a dictionary" as mentioned in monocongo#495. Replacing .drop_sel with .drop_var resolved the issue. A similar fix was proposed in monocongo#493, but some calls to .drop_sel remained.
I received the same error. I checked the structure of my data, it looks correct. I appreciate if you could help me.
|
Please post a link to your data @Mahsabzg |
Thank you for your immediate answer. I installed it with:
I upload my input dataset. |
I also upload my original data and and how to prepare it.
|
When I applied this to a global scale, the latitude range excluded -90 and 90 degrees. |
@keyao22 How the math works for some of the indices precludes the usage of the top/bottom limits, i.e. 90/-90 degrees throws the calculations into infinity etc. Another example is that the Thornthwaite PET can't be computed above or below 60 degrees lat. |
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
To Reproduce
Steps to reproduce the behavior:
(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
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: