Note
Go to the end to download the full example code.
Spatial difference plot¶
Generate spatial map of a 2D field difference (regional data example).
References
General functionality is provided using CSET recipe surface_spatial_difference.yaml
The following CSET operators are used:
Using cset bake on the command line¶
Access recipe file using
cset cookbook.Set required recipe inputs on command line.
Example to generate full-domain spatial difference maps of temperature_at_screen_level between 2 input model files for all output times:
cset cookbook surface_spatial_difference.yaml
cset -v bake -i "/path/to/input/data_1" "/path/to/input/data_2" \
-o "./output_path" \
-r surface_spatial_difference.yaml \
--VARNAME="temperature_at_screen_level" \
--BASE_MODEL="my_model_1_label" \
--OTHER_MODEL="my_model_2_label" \
--METHOD="SEQ" \
--SUBAREA_TYPE='None' --SUBAREA_EXTENT='None' --SUBAREA_NAME=''
Configuring the cset_workflow¶
Update workflow configuration settings via
rose editGUI or inrose-suite.conffile.Complete
General setup optionsandCycling and Model optionsdetails - see Configure the workflow.Set required configuration options on
Diagnostics / Surface (2D) fieldspanel:SURFACE_FIELDS = ["temperature_at_screen_level", ...] SPATIAL_DIFFERENCE_SURFACE_FIELD = True
Example python code¶
![temperature_at_screen_level_difference [2022-09-21 05:00:00]](../../../../_images/sphx_glr_plot_surface_spatial_difference_001.png)
from CSET import sample_data_path
from CSET.operators import misc, plot, read
# Set path to input data
filename1 = sample_data_path("air_temperature_1.nc")
filename2 = sample_data_path("air_temperature_2.nc")
# Read selected variable(s) of interest
cubes = read.read_cubes([filename1, filename2], ["temperature_at_screen_level"])
# Compute difference between input cubes
diff = misc.difference(cubes)
# Plot single time using spatial_pcolormesh_plot
plot.spatial_pcolormesh_plot(diff[-1])
Total running time of the script: (0 minutes 0.475 seconds)