Press: n or <space> ↦ Next slide ♦ p ↦ Previous Slide ♦ ? ↦ Help Menu
by: Andrej Fast, Brian Lewis, Christopher Kadow, Etor Lucio Eceiza, Mahesh Ramadoss, Martin Bergemann and many others
import freva
import xarray as xr
files = freva.databrowser(
project="cmip6",
experiment="historical",
model="mpi*",
ensemble="r1i1*",
variable="tas",
time_frequency="mon"
)
dset = xr.open_mfdataset(files, combine="by_coords", parallel=True)
⋊ freva databrowser project=cmip6 experiment=historical model='mip*' ensemble='r1i1*' time_frequency=mon variable=tas
Solution: Create a freva plugin.
from evaluation_system.api import plugin
from evaluation_system.api.parameters import File, ParameterDictionary, SolrField
class PlottingTool(plugin.PluginAbstract):
"""Plugin that plots content of selected data."""
# Plugin setup
tool_developer = {"name": "Jane Doe", "email": "Jane.Doe@example.com"}
__category__ = "support"
__short_description__ = "Plot data"
__version__ = (2022, 1, 1)
__parameters__ = ParameterDictionary(
File(
name="in_file",
file_extension="nc",
mandatory=True,
help="Select the input netCDF file.",
),
SolrField(
name="variable",
mandatory=False,
facet="variable",
help=("Select the variables(s) to be plotted"),
max_items=1,
)
)
# Workflow definition of the actual tool
def run_tool(self, setup: dict[str, str]) -> None:
"""This method calls the actual plugin."""
self.call(
f"python src/plot_map.py {setup['in_file']} -v {setup['variable']}"
)
⋊ freva plugin -l
Animator: Animate data on lon/lat grids
ClimateChangeProfile: Create climate change signals.
ClimDexCalc: Calculate the ETCCDI climate extreme indices on the
basis of daily temperature and precipitation data using
the ClimDex software provided by PCIC.
Climpact: Process climate model data for input of impact model
CWT: Calculate Circulation Weather Type by mean sea level pressure.
EnsemblePlotter: Create and Plot maps of multi-model ensemble means and
standard deviations
MoviePlotter: Plots 2D lon/lat movies in GIF format
Papermill: Parametrize a given notebook
PlottingTool: Plot data
⋊ freva plugin plottingtool --doc
PlottingTool (v2022.1.1): Plot data
Options:
in_file (default: <undefined>) [mandatory]
Select the input netCDF file.
variable (default: <undefined>)
Select the variables(s) to be plotted