-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathplot_line_timeseries.py
More file actions
66 lines (48 loc) · 2.34 KB
/
Copy pathplot_line_timeseries.py
File metadata and controls
66 lines (48 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""
Time series plot
================
Generate time series of region-averaged field.
.. admonition:: References
General functionality is provided using :doc:`CSET recipe </usage/operator-recipes>` ``generic_surface_domain_mean_time_series.yaml``
The following CSET operators are used:
* :py:mod:`CSET.operators.read.read_cubes`
* :py:mod:`CSET.operators.collapse.collapse`
* :py:mod:`CSET.operators.plot.plot_line_series`.
Using *cset bake* on the command line
-------------------------------------
* Access recipe file using ``cset cookbook``.
* Set required recipe inputs on command line.
Example to generate time series plot of domain averaged ``temperature_at_screen_level`` for any number of input models::
cset cookbook generic_surface_domain_mean_time_series.yaml
cset -v bake -i "/path/to/input/data1" "..." "/path/to/input/dataN" \\
-o "./output_path" \\
-r generic_surface_domain_mean_time_series.yaml \\
--VARNAME="temperature_at_screen_level" \\
--MODEL_NAME="['my_model_label1' '...' 'my_model_labelN']" \\
--METHOD="SEQ" \\
--SUBAREA_TYPE='None' --SUBAREA_EXTENT='None' --SUBAREA_NAME=''
Configuring the *cset_workflow*
-------------------------------
* Update workflow configuration settings via ``rose edit`` GUI or in ``rose-suite.conf`` file.
* Complete ``General setup options`` and ``Cycling and Model options`` details - see :doc:`/usage/workflow-configure`.
* Set required configuration options on ``Diagnostics / Surface (2D) fields`` panel::
SURFACE_FIELDS = ["temperature_at_screen_level", ...]
TIMESERIES_SURFACE_FIELD = True
Example python code
-------------------
"""
from CSET import sample_data_path
from CSET.operators import collapse, plot, read
# Set paths to input data
filename1 = sample_data_path("air_temperature_fcst_1.nc")
filename2 = sample_data_path("air_temperature_fcst_2.nc")
# Read selected variable(s) of interest for 2 models
cubes = read.read_cubes(
[filename1, filename2],
["temperature_at_screen_level"],
model_names=["model_fcst_1", "model_fcst_2"],
)
# Collapse input data over selected dimensions
collapsed_cubes = collapse.collapse(cubes, ["grid_latitude", "grid_longitude"], "MEAN")
# Plot domain mean time series using plot_line_series
plot.plot_line_series(collapsed_cubes)