bopen / c3s-eqc-toolbox-template

CADS Toolbox template application
Apache License 2.0
5 stars 4 forks source link

Error with diagnostic.py #12

Closed paololanteri closed 1 year ago

paololanteri commented 1 year ago

While running the template for climate projections I encountered the following error:


TypeError Traceback (most recent call last) /tmp/ipykernel_1946/2118281780.py in 4 5 import c3s_eqc_toolbox_template ----> 6 from c3s_eqc_automatic_quality_control.c3s_eqc_automatic_quality_control import diagnostics, download, plot 7 8 warnings.filterwarnings("ignore")

~/bin/c3s_eqc_automatic_quality_control/c3s_eqc_automatic_quality_control/diagnostics.py in 23 24 def _spatial_weights( ---> 25 obj: xr.Dataset | xr.DataArray, lon: str = "longitude", lat: str = "latitude" 26 ) -> xr.DataArray: 27 cos = np.cos(np.deg2rad(obj[lat]))

TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'type'

Let me recap the steps I made: -I downloaded the latest version of c3s-eqc-toolbox-template and c3s-eqc-automatic-quality-control from b-open github webpage -i put them in the VM under /data/wp4/bin/ -I run the notebook template you developed for climate projections and I get the error above.

Any error from my side? Thank you

malmans2 commented 1 year ago

I think you are just using the wrong version of python. We only test python 3.10 at the moment. You should follow these instructions: https://github.com/bopen/c3s-eqc-toolbox-template#workflow-for-developerscontributors

Here is a recap (just substitute DEVELOP with the name of your environment):

git clone git@github.com:bopen/c3s-eqc-toolbox-template.git
cd c3s-eqc-toolbox-template
conda create -n DEVELOP -c conda-forge python=3.10
conda activate DEVELOP
make conda-env-update
paololanteri commented 1 year ago

Thank you Mattia, I tried to run git clone git@github.com:bopen/c3s-eqc-toolbox-template.git on /data/wp4/ but I got the following error:

(DEVELOP) (BO)quality.shared.cds [wp4@eqc-quality-tools ~]$ git clone git@github.com:bopen/c3s-eqc-toolbox-template.git
Cloning into 'c3s-eqc-toolbox-template'...
Warning: Permanently added '[github.com](http://github.com/),140.82.121.4' (ECDSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The same command on /home/eqcuser seems working. Do we miss some rights in /data/wp4 folder?

malmans2 commented 1 year ago

I think you are just missing the ssh key for GitHub. But you don't really need it, the template repo is public. Try to clone from https:

git clone https://github.com/bopen/c3s-eqc-toolbox-template.git
paololanteri commented 1 year ago

Thank you Mattia, I can run the notebook templates for climate projection correctly now!

malmans2 commented 1 year ago

Great!