improver
improver copied to clipboard
Refactor nbhood CLI
As an IMPROVER developer I want a clear neighbourhood processing interface so that it is easy to work with.
Our neighbourhood processing has grown organically with lots of new capability - we need to implement the functionality identified in IMPRO-460 to ensure we can support the necessary types of neighbourhood processing.
Acceptance criteria:
- Out of scope: generation of percentiles (#459), vicinity (#460), plugin changes, suite changes (IMPRO-589)
- Combine all other nbhood CLIs into one, combining options as proposed below
- CLI acceptance tests should still pass with only minor name/structure changes, except for removed behaviour.
Description:
Proposed option changes:
- Specify circle/circle_weighted/square/square_recursive as options to a single
--kernel
option - Make square + recursive filter the default for all neighbourhood processing, with default values for the alphas
- Remove ens_factor, re_mask, intermediate masked file dumping options and recursive-filter-only behaviour
- Merge --radius and --radii-by-lead-time, avoiding space separation for lead times
- Keep topographic band options but rename so that they use zone or band rather than explicitly mentioning topography
- Land sea processing should be an option rather than a separate CLI
- Set default for coord_for_masking option (Always topographic zone?)
- Invert collapse dimension so that it is always true
- Others as you feel necessary
Example new behaviours:
# Synopsis
improver nbhood [OPTIONS] --radius=RADIUS INPUT_FILE OUTPUT_FILE
# Run default neighbourhood processing with radius 10km and save to an output file.
improver nbhood --radius=10000 input_file.nc output_file.nc
# Run lead-time-dependent-radii neighbourhood processing, interpolating radii for different lead times:
improver nbhood --radius=10000,20000,40000 --lead-times=PT0H,PT12H,PT24H input_file.nc output_file.nc
# Run circular neighbourhood processing.
improver nbhood --kernel=circle --radius=10000 input_file.nc output_file.nc
# Run non-recursively-filtered square neighbourhood processing.
improver nbhood --kernel=square --radius=10000 input_file.nc output_file.nc
# Use (e.g. topographically based) masks to neighbourhood process across different zones.
improver nbhood --radius=50000 --input-mask=topographic_zones.nc --input-mask-collapse-weights=topographic_collapse_zone_weights.nc input_file.nc output_file.nc
# Use (e.g. topographically based) masks to neighbourhood process across different zones, treating land and sea independently:
improver nbhood --radius=50000 --land-sea --input-mask=topographic_zones_with_land_sea_masking.nc --input-mask-collapse-weights=topographic_collapse_zone_weights.nc input_file.nc output_file.nc
# Use (e.g. topographically based) masks to neighbourhood process across different zones, keeping the different zones in the output:
improver nbhood --radius=50000 --no-collapse-mask --input-mask=topographic_zones.nc --input-mask-collapse-weights=topographic_collapse_zone_weights.nc input_file.nc output_file.nc
@fionaRust, do we need to amend/close this one?