ECCO-GROUP / ECCOv4-py

A Python library with routines that support the loading, analysis, and plotting fields of the ECCO Version 4 Ocean and Sea-Ice State Estimate. The ecco_v4_py library builds on several valuable tools such as xmitgcm, gcm, xarray, and dask.
MIT License
31 stars 31 forks source link

ValueError using ecco_v4_py.vector_calc.UEVNfromUXVY #151

Open simonwettocean opened 4 months ago

simonwettocean commented 4 months ago

Hi,

I am having some trouble running ecco_v4_py.vector_calc.UEVNfromUXVY, actually while executing cell 13 from this example notebook for displaying output from the Arctic Subpolar gyre sTate Estimate (ASTE): https://github.com/crios-ut/aste/blob/master/aste_llcreader_example.ipynb

The code works fine for the first few cells but then fails in cell 13, where the uvel and vvel values are calculated using

ecco_v4_py.vector_calc.UEVNfromUXVY.

I suspect this has something to to with a new version of a python package I am using (possibly dask?). Possibly a downgrade of some packages I am using could resolve the problem? I am attaching the full error message and a list of my installed packages.

Any help is very much appreciated!

Cheers,

Simon

aste_llcreader_example_cell13_output.txt my_python_packages.txt

timothyas commented 3 months ago

Hi @simonwettocean! Could you show the code that created this error? It's hard to figure out what's going on without context.

simonwettocean commented 3 months ago

Hi @timothyas, thanks for getting back to me! Sorry for my delayed response, I am at sea at the moment.

Here is the code that results in the error, mentioned above:

uvel,vvel = ecco_v4_py.vector_calc.UEVNfromUXVY(ds['UVELMASS'].sel(k=0), ds['VVELMASS'].sel(k=0), coords=cds, grid=grid)

Where 'ds' is the xarray dataset that includes the variables 'UVELMASS' and 'VVELMASS'. The full code of the example I am trying to execute is available on the following GitHub repository: https://github.com/crios-ut/aste/blob/master/aste_llcreader_example.ipynb

simonwettocean commented 3 months ago

I have traced it down to the error occurring in the '_maybe_rename_grid_positions' function. The error can be avoided when changing the line 'if di not in arr_source:' to 'if di not in arr_source.dims:' in that function. However that raises more errors, so I'm not sure if this is a good way of troubleshooting.

Interestingly, I managed to run the UEVNfromUXVY function in this example for ECCO: https://ecco-v4-python-tutorial.readthedocs.io/ECCO_v4_Interpolating_Fields_to_LatLon_Grid.html

Thus, I suspect it is related to the specifics of the ASTE data set. Do you have any idea what could cause this error and how I could resolve it? Any help is greatly apreciated.