-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathplot_surface_spatial_cutout.py
More file actions
68 lines (51 loc) · 2.58 KB
/
Copy pathplot_surface_spatial_cutout.py
File metadata and controls
68 lines (51 loc) · 2.58 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
67
68
"""
Trim edge gridcells
===================
Generate spatial map of a 2D field over selected sub-region of data with specified number of grid cells at domain edges trimmed.
.. admonition:: References
General functionality is provided using :doc:`CSET recipe </usage/operator-recipes>` ``generic_surface_spatial_plot_sequence.yaml``
The following CSET operators are used:
* :py:mod:`CSET.operators.read.read_cubes`
* :py:mod:`CSET.operators.plot.spatial_pcolormesh_plot` or :py:mod:`CSET.operators.plot.spatial_contour_plot`.
Using *cset bake* on the command line
-------------------------------------
* See :doc:`/reference/gallery/generated/spatial/plot_surface_spatial` for general settings.
* Set ``SUBAREA_TYPE`` to ``gridcells`` and ``SUBAREA_EXTENT`` to select edge trim widths [lower, upper, left, right].
* Use ``SUBAREA_NAME`` to add a plot label if required, or leave blank.
Example to generate spatial maps of ``temperature_at_screen_level`` for a selected sub-area all output times::
cset cookbook generic_surface_spatial_plot_sequence.yaml
cset -v bake -i "/path/to/input/data" -o "./output_path" \\
-r generic_surface_spatial_plot_sequence.yaml \\
--VARNAME="temperature_at_screen_level" \\
--MODEL_NAME="my_model_label" \\
--METHOD="SEQ" \\
--SUBAREA_TYPE='gridcells' --SUBAREA_EXTENT='[3, 2, 3, 1]' --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 ``SELECT_SUBAREA`` to ``True``, set ``SUBAREA_TYPE`` to ``gridcells`` and set ``SUBAREA_EXTENT`` and ``SUBAREA_NAME``.
* Set other required configuration options on ``Diagnostics / Surface (2D) fields`` panel::
SELECT_SUBAREA = True
SPATIAL_SURFACE_FIELD = True
SUBAREA_TYPE = 'gridcells'
SUBAREA_EXTENT = [3, 2, 3, 1]
SUBAREA_NAME = ''
SURFACE_FIELDS = ["temperature_at_screen_level", ...]
SPATIAL_SURFACE_FIELD = True
Example python code
-------------------
"""
from CSET import sample_data_path
from CSET.operators import plot, read
# Set path to input data
filename = sample_data_path("air_temperature.nc")
# Read selected variable(s) of interest
cube = read.read_cube(
filename,
["temperature_at_screen_level"],
subarea_type="gridcells",
subarea_extent=[3, 2, 3, 1],
)
# Plot single time using spatial_contour_plot
plot.spatial_contour_plot(cube[-1])