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

The introduction.ipynb tutorial fails when attempting make the first contour plot. #7

Open
noaaroland opened this issue Oct 12, 2023 · 3 comments

Comments

@noaaroland
Copy link

This is likely a bug for cf-plot or possibly cf-python, but since I cannot tell and it manifests itself in this tutorial I'm putting the issue here. If you want me to do something else, please let me know.

# Make a contour plot of the data
cfp.con(t_500)

Fails. The kernel dies.

This bit of code illustrates the problem directly:

import cf
import cfplot as cfp
f1 = cf.read('ncas_data/data1.nc')
temp = f1.select('air_temperature')[0]
print(temp)
t_500 = temp.subspace(pressure=500)
print(t_500)
cfp.gopen(file='airt.png')
cfp.con(t_500)
cfp.gclose()
(cf) [rhs@sour cf-tools-training]$ python airt.py
Field: air_temperature (ncvar%T)
--------------------------------
Data            : air_temperature(time(1), pressure(23), latitude(160), longitude(320)) K
Dimension coords: time(1) = [1964-01-21 00:00:00]
                : pressure(23) = [1000.0, ..., 1.0] mbar
                : latitude(160) = [89.14151763916016, ..., -89.14151763916016] degrees_north
                : longitude(320) = [0.0, ..., 358.875] degrees_east
Field: air_temperature (ncvar%T)
--------------------------------
Data            : air_temperature(time(1), pressure(1), latitude(160), longitude(320)) K
Dimension coords: time(1) = [1964-01-21 00:00:00]
                : pressure(1) = [500.0] mbar
                : latitude(160) = [89.14151763916016, ..., -89.14151763916016] degrees_north
                : longitude(320) = [0.0, ..., 358.875] degrees_east
Segmentation fault (core dumped)

The environment listing is attached.

env.txt

@davidhassell
Copy link
Contributor

Thanks Roland - I get the same (both in a notebook and normal on the command line). It seems to be perhaps be a problem with cf-plot ... @ajheaps, could you perhaps try this, too?

My environment:
env2.txt

@ajheaps
Copy link

ajheaps commented Oct 13, 2023

Hi Roland,
A segfault is quite a severe Python reaction! I think there was a change to the regriding esmpy package not too long ago and somehow when making a map plot it causes this failure. I think if esmpy is not installed or you are not making a map plot then all is well. This is quite strange as there is no regrinding going on here before making the map plot as far as I am aware.

I will have a good look at this early next week but in the meantime you could try typing the following on the command line before starting Python:
unset ESMFMKFILE
and that might help.
If not you could try uninstalling esmpy and see if that fixes it.
If that doesn't work then reinstall Python but leave out esmpy from the install process.

@noaaroland
Copy link
Author

noaaroland commented Oct 13, 2023

Thank you all for taking a look at this. For the time being, I have rebuilt my environment without esmpy and I can make map plots.

I'll keep an eye out here for when it's safe to upgrade and re-install esmpy. (plot unrelated to above example, it's model output from our lab)

sm_cop

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

3 participants