Skip to content

Commit

Permalink
adds example recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
daflack committed Dec 9, 2024
1 parent 31a0939 commit 9b7afdb
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/CSET/recipes/combined_mask_addition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
category: Quick Look
title: Example adding masks for 'OR' or "between" type filters
description: |
Generates and applies two masks, and adds them together for more complex stratified analysis.
steps:
- operator: read.read_cubes

- operator: filters.apply_mask
original_field:
operator: filters.filter_cubes
constraint:
operator: constraints.combine_constraints
variable_constraint:
operator: constraints.generate_var_constraint
varname: surface_air_temperature
cell_method_constraint:
operator: constraints.generate_cell_methods_constraint
cell_methods: []
masks:
operator: misc.addition
addend_1:
operator: filters.generate_mask
mask_field:
operator: filters.filter_cubes
constraint:
operator: constraints.generate_var_constraint
varname: surface_altitude
condition: '<'
value: 500
addend_2:
operator: filters.generate_mask
mask_field:
operator: filters.filter_cubes
constraint:
operator: constraints.generate_var_constraint
varname: surface_altitude
condition: '>'
value: 200

- operator: collapse.collapse
coordinate: [grid_latitude, grid_longitude]
method: MEAN

- operator: write.write_cube_to_nc
overwrite: True

- operator: plot.plot_line_series
48 changes: 48 additions & 0 deletions src/CSET/recipes/combined_mask_multiplication.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
category: Quick Look
title: Example adding masks for 'AND' type filters
description: |
Generates and applies two masks, and multiplies them together for more complex stratified analysis.
steps:
- operator: read.read_cubes

- operator: filters.apply_mask
original_field:
operator: filters.filter_cubes
constraint:
operator: constraints.combine_constraints
variable_constraint:
operator: constraints.generate_var_constraint
varname: surface_air_temperature
cell_method_constraint:
operator: constraints.generate_cell_methods_constraint
cell_methods: []
masks:
operator: misc.multiplication
multiplicand:
operator: filters.generate_mask
mask_field:
operator: filters.filter_cubes
constraint:
operator: constraints.generate_var_constraint
varname: surface_altitude
condition: '>'
value: 500
multiplier:
operator: filters.generate_mask
mask_field:
operator: filters.filter_cubes
constraint:
operator: constraints.generate_var_constraint
varname: surface_air_temperature
condition: '<='
value: 273

- operator: collapse.collapse
coordinate: [grid_latitude, grid_longitude]
method: MEAN

- operator: write.write_cube_to_nc
overwrite: True

- operator: plot.plot_line_series
36 changes: 36 additions & 0 deletions src/CSET/recipes/simple_mask.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
category: Quick Look
title: Example simple mask application
description: Generates and applies a simple mask to a field for stratified analysis.

steps:
- operator: read.read_cubes

- operator: filters.apply_mask
original_field:
operator: filters.filter_cubes
constraint:
operator: constraints.combine_constraints
variable_constraint:
operator: constraints.generate_var_constraint
varname: surface_air_temperature
cell_method_constraint:
operator: constraints.generate_cell_methods_constraint
cell_methods: []
masks:
operator: filters.generate_mask
mask_field:
operator: filters.filter_cubes
constraint:
operator: constraints.generate_var_constraint
varname: surface_altitude
condition: '>='
value: 500

- operator: collapse.collapse
coordinate: [grid_latitude, grid_longitude]
method: MEAN

- operator: write.write_cube_to_nc
overwrite: True

- operator: plot.plot_line_series

0 comments on commit 9b7afdb

Please sign in to comment.