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

seaice diags needs refactoring #83

Open
raphaeldussin opened this issue Jul 19, 2021 · 0 comments
Open

seaice diags needs refactoring #83

raphaeldussin opened this issue Jul 19, 2021 · 0 comments

Comments

@raphaeldussin
Copy link
Owner

plot function does not work:

fig = plot(model, obs, regridded, valid_mask)                                                                                                                                                                          
/net2/rnd/anaconda3/envs/repro/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py:1491: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
  X, Y, C = self._pcolorargs('pcolormesh', *args, allmatch=allmatch)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-20-8404f36099d9> in <module>
----> 1 fig = plot(model, obs, regridded, valid_mask)

/net2/rnd/anaconda3/envs/repro/lib/python3.8/site-packages/om4labs-0.0.1-py3.8.egg/om4labs/diags/seaice/seaice.py in plot(model, obs, regridded, valid_mask, label, region, month)
    272     plotdata = (model["ac"][month_index] * 100.0).to_masked_array()
    273     plotdata = np.ma.masked_where(valid_mask, plotdata)
--> 274     cb1 = _plot_map_panel(ax, x, y, plotdata, extent=extent)
    275     ax.set_title(f"Model - Years {model.time[0]} to {model.time[1]}")
    276     fig.colorbar(

/net2/rnd/anaconda3/envs/repro/lib/python3.8/site-packages/om4labs-0.0.1-py3.8.egg/om4labs/diags/seaice/seaice.py in _plot_map_panel(ax, x, y, plotdata, cmap, vmin, vmax, extent, contour)
    235     cmap.set_bad(color="#555555", alpha=1)
    236     ax.set_extent(extent, ccrs.PlateCarree())
--> 237     cb = ax.pcolormesh(
    238         x, y, plotdata, transform=ccrs.PlateCarree(), cmap=cmap, vmin=vmin, vmax=vmax
    239     )

/net2/rnd/anaconda3/envs/repro/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py in pcolormesh(self, *args, **kwargs)
   1457                              ' consider using PlateCarree/RotatedPole.')
   1458         kwargs.setdefault('transform', t)
-> 1459         result = self._pcolormesh_patched(*args, **kwargs)
   1460         self.autoscale_view()
   1461         return result

/net2/rnd/anaconda3/envs/repro/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py in _pcolormesh_patched(self, *args, **kwargs)
   1489         allmatch = (shading == 'gouraud')
   1490 
-> 1491         X, Y, C = self._pcolorargs('pcolormesh', *args, allmatch=allmatch)
   1492         Ny, Nx = X.shape
   1493 

ValueError: too many values to unpack (expected 3)

too many computations/reductions are made in the plot function which is against the design of having calculate output numpy arrays ready for the plot part

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