gemini3d / pygemini

Python interface for Gemini3D
Apache License 2.0
8 stars 3 forks source link

pygemini dipole plotting broken #13

Closed mattzett closed 2 years ago

mattzett commented 2 years ago

For some reason this is just returning nans now all of the sudden with this warning:

<__array_function__ internals>:5: UserWarning: Warning: converting a masked element to nan.
/Users/zettergm/opt/miniconda3/lib/python3.8/site-packages/numpy/core/_asarray.py:102: UserWarning: Warning: converting a masked element to nan.
  return array(a, dtype, copy=False, order=order)

Is this some weird typing issue xarray vs. np.array?

mattzett commented 2 years ago

Somehow this works when you call plotcurv and produces sensible output but not when you all it from some base program:

https://github.com/gemini3d/pygemini-scripts/blob/main/gridoutput/examplemag3D.py

I.e. this works:

# these plotting functions will internally grid data
print("Plotting...")
plotcurv3D(xg, dat[parm], cfg, lalt=128, llon=128, llat=128, coord="geographic")

But this produces nans:

malti, mloni, mlati, parmmi = model2magcoords(xg, dat[parm], lalt, llon, llat)

Yet all the former does is call the latter function in exactly the same manner!!!

mattzett commented 2 years ago

Actually this same issue is totally wrecking all the plotting features; they are just return NaN now... so this is a big problem.

mattzett commented 2 years ago

Okay any dipole simulation is going to fail to plot run now, e.g. try the cusp3D cases from gemCI if you need to reproduce this.

mattzett commented 2 years ago

The offending commit is this one: https://github.com/gemini3d/pygemini/commit/2047e9110a1a79ce55e4f179a8ed4b1c4ff30a45 although I'm sure I checked this one before. I'm guessing there is some interaction with a rebase that happened that caused this to error out.

mattzett commented 2 years ago

@scivision I'm totally stumped by this and it's a total showstopper no plotting works. Is this some issue with typing and xarray? Take any curvilinear simulation and try to plot it and you'll get a bunch of nans.

mattzett commented 2 years ago

Okay I had an incorrect gridding/interpolation call buried in the geomag gridding; an issue of too many similarly named functions.