Note
Go to the end to download the full example code.
Plot coastal only data#
This example shows how to plot the PO4 distribution in each basin.
This example is independent from GENIE’s mask
![time = 9.5 [Year mid-point]](../_images/sphx_glr_plot_coastal_data_001.png)
/home/docs/checkouts/readthedocs.org/user_builds/cgeniepy/envs/latest/lib/python3.12/site-packages/cgeniepy/model.py:58: UserWarning: No gemflag is provided, use default gemflags: [biogem]
warnings.warn("No gemflag is provided, use default gemflags: [biogem]")
<matplotlib.collections.QuadMesh object at 0x74230a1751f0>
import xarray as xr
import cgeniepy
import numpy as np
model = cgeniepy.sample_model()
sst = model.get_var('ocn_sur_temp').isel(time=-1)
## grid category is a pre-defined 2D data
## 0: coastal
## 1: land
## 2: open ocean
gc = model.grid_category()
## coastal region
xr.where(gc == 0, sst.data, np.nan).plot()
Total running time of the script: (0 minutes 0.133 seconds)