Skip to content
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

deal with netcdf file not well described #68

Open
lj-mu opened this issue Jan 7, 2025 · 0 comments
Open

deal with netcdf file not well described #68

lj-mu opened this issue Jan 7, 2025 · 0 comments

Comments

@lj-mu
Copy link

lj-mu commented Jan 7, 2025

Really nice software!

I just wonder if psy-view could support some wired netcdf files, for example:

netcdf omega3 {
dimensions:
i = 9011 ;
j = 8939 ;
k = 6 ;
variables:
float momVort3(k, j, i) ;
momVort3:long_name = "3rd component (vertical) of Vorticity" ;
momVort3:units = "s^-1" ;
momVort3:grid_loc = "3220" ;

// global attributes:
:CDI = "Climate Data Interface version 2.4.4 (https://mpimet.mpg.de/cdi)" ;
:Conventions = "none" ;

where, the coordinate is not provided in details.

When I open this nc file using psy-view, I got below error:

Traceback (most recent call last):
File "/Users/miniconda3/bin/psy-view", line 11, in
sys.exit(main())
^^^^^^
File "/Users/miniconda3/lib/python3.11/site-packages/psy_view/init.py", line 161, in main
start_app(ds, args.name, args.plotmethod, args.preset)
File "/Users/miniconda3/lib/python3.11/site-packages/psy_view/init.py", line 73, in start_app
ds_widget = DatasetWidgetStandAlone(ds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/miniconda3/lib/python3.11/site-packages/psy_view/ds_widget.py", line 340, in init
self.refresh()
File "/Users/miniconda3/lib/python3.11/site-packages/psy_view/ds_widget.py", line 1588, in refresh
valid_variables = self.plotmethod_widget.valid_variables(self.ds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/miniconda3/lib/python3.11/site-packages/psy_view/plotmethods.py", line 825, in valid_variables
xc_dims = set(ds[self.combo_xcoord.currentText()].dims)
~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/miniconda3/lib/python3.11/site-packages/xarray/core/dataset.py", line 1547, in getitem
raise KeyError(
KeyError: "No variable named ''. Variables on the dataset include ['momVort3']"

It seems that psy-view is not able to deal with such exception. Could you add such feature? as for high-resolution model results, not always coordinates info are provided. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant