Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature #1283 mvmode mods #2569

Merged
merged 44 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c76c548
Per #2426, port bugfix over for the develop branch.
JohnHalleyGotway Feb 2, 2023
8bca0e9
initial commit of a script designed to pull NDBC station info from th…
davidalbo Feb 17, 2023
a09e43d
Redesigned python scrip build_ndbc_stations_from_web.py to use a class
davidalbo Feb 24, 2023
0212205
Implemented the approach suggested by Gwen Chen NOAA
davidalbo Feb 24, 2023
a975a77
Added new NDBC stations updating script to make
davidalbo Feb 27, 2023
dcb1494
Updated ndbc_stations.xml file
davidalbo Feb 27, 2023
c3d5c89
Added documentation about the NDBC stations update script option
davidalbo Feb 27, 2023
9634cc9
Changed to not write out an elevation when input elevation is not found
davidalbo Feb 28, 2023
673b1fa
For multivariate mode, modified to do everything in one run, keeping …
davidalbo Apr 7, 2023
fbb2db0
Bug fix
davidalbo Apr 7, 2023
5d4f8ad
added the multivar_intensity_flag logic, added config checks for that…
davidalbo Apr 11, 2023
36a7fc3
compile bug fixes
davidalbo Apr 11, 2023
b1209a3
Merging develop into feature_1283_mvmode_mods
davidalbo Apr 12, 2023
0197bbe
refactored the code for readability
Apr 13, 2023
34638c2
Cosmetic changes
davidalbo Apr 14, 2023
ade2c09
Changed indentation style for mode source code
davidalbo Apr 14, 2023
bccc761
add checks for non-implemented multivar mode configs, add processing …
Apr 17, 2023
f1ba975
put BoolArray in the libs along with a config lookup, changed 1st pas…
Apr 18, 2023
a1b1ffc
changed output file names and organization, print a warning with merg…
Apr 19, 2023
4d7165d
Bugfix in which single var mode output file names had incorrectly cha…
Apr 20, 2023
1741a81
Cleanup and a few tweaks
Apr 21, 2023
0133a47
Merge remote-tracking branch 'origin/develop' into feature_1283_mvmod…
davidalbo Apr 24, 2023
9c58d59
Change to create the output directory recursively if needed
davidalbo Apr 26, 2023
39e0a8d
Bug fix
Apr 26, 2023
0a4c832
changed actions taken in pass1/pass2 for multivariate mode, detect mo…
Apr 28, 2023
14ab55f
merging algorithm changes for multivar mode prior to cleanup and testing
May 12, 2023
dc725ee
multivar_mode changes with some testing and cleanup
May 18, 2023
4e3f915
Merge branch 'develop' into feature_1282_mvmode_mods
May 18, 2023
f1d8da1
tweak after merging develop into this branch
May 18, 2023
1812a05
test
Jun 1, 2023
3f2f664
Implemented the case of just superobjects with no intensity information
davidalbo Jun 1, 2023
3afb8ef
Merge remote-tracking branch 'origin/develop' into feature_1282_mvmod…
davidalbo Jun 1, 2023
d4119c6
Changed the multivar mode unit test
davidalbo Jun 2, 2023
2cf7a06
Took out -field_index as a command option, modified unit test for mul…
davidalbo Jun 5, 2023
7aa4d59
Changed output file names to avoid wildcards and parens, and modified…
davidalbo Jun 5, 2023
cd73b19
More tests for consistency and disallowing some config settings (for …
davidalbo Jun 8, 2023
529c20a
cleanup before pull request
davidalbo Jun 9, 2023
ee783f6
Bug fix in which a multivar consistency test was done when not multivar
davidalbo Jun 9, 2023
f9279f0
Merge remote-tracking branch 'origin/develop' into feature_1283_mvmod…
JohnHalleyGotway Jun 12, 2023
3e9ca75
Per #1283, move multivar mode config file setting definitions into co…
JohnHalleyGotway Jun 12, 2023
ce129d8
Changed output file names for '(*,*)' to '_all_all_'
davidalbo Jun 12, 2023
41c48bb
Bug fix in which convolution thresholds and radii were incorrectly sp…
davidalbo Jun 13, 2023
ccfcdfc
Fixed units/level problem in output files, prepended superobject name…
davidalbo Jun 15, 2023
0e05d4f
Per #1283, ci-skip-all, no real code changes. Just whitespace tweaks …
JohnHalleyGotway Jun 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Users_Guide/config_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ and, in some cases, elevation for all stations based on stationId.
This set of stations comes from 2 online sources: the
`active stations website <https://www.ndbc.noaa.gov/activestations.xml>`_
and the `complete stations website <https://www.airnow.gov>`_.

As these lists can change as a function of time, a script can be run to pull
down the contents of both websites and merge any changes with the existing stations
file content, creating an updated stations file locally.
Expand All @@ -301,7 +302,6 @@ can be deleted once the final output file is created.

MET_BASE
^^^^^^^^

The MET_BASE variable is defined in the code at compilation time as the path
to the MET shared data. These are things like the default configuration files,
common polygons and color scales. MET_BASE may be used in the MET configuration
Expand Down
34 changes: 32 additions & 2 deletions docs/Users_Guide/mode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,13 @@ Multi-Variate MODE

Traditionally, MODE defines objects by smoothing and thresholding data from a single input field. MET version 10.1.0 extends MODE by adding the option to define objects using multiple input fields.

As described in :numref:`MODE-configuration-file`, the **field** entry in the forecast and observation dictionaries define the input data to be processed. If **field** is defined as a dictionary, the traditional method for running MODE is invoked, where objects are defined using a single input field. If **field** is defined as an array of dictionaries, each specifying a different input field, then the multi-variate MODE logic is invoked and requires the **multivar_logic** configuration entry to be set. Traditional MODE is run once for each input field to define objects for that field. Note that the object definition criteria can be defined separately for each field array entry. The objects from each input field are combined into a *super* object for both the forecast and observation data.
As described in :numref:`MODE-configuration-file`, the **field** entry in the forecast and observation dictionaries define the input data to be processed. If **field** is defined as a dictionary, the traditional method for running MODE is invoked, where objects are defined using a single input field. If **field** is defined as an array of dictionaries, each specifying a different input field, then the multi-variate MODE logic is invoked and requires the **multivar_logic** configuration entry to be set. Traditional MODE is run once for each input field to define objects for that field. Note that the object definition criteria can be defined separately for each field array entry. The objects from each input field are combined into forecast and observation data *super* objects

The **multivar_logic** and **multivar_intensity** configuration entries, described in :numref:`MODE-configuration-file`, define the boolean logic for combining objects from multiple fields into *super* objects, and then optionally computing intensities for individual input fields when the input is masked to non-missing only inside the *super* objects. If the **multivar_logic** configuration option iset, there must be the same number of fields defined in an array of dictionaries for fcst and for obs as indicated in the **multivar_logic**. Note that the multi-variate MODE forecast and observation input fields and combination logic do not need to
match. If a particular **multivar_intensity** value is TRUE the corresponding pair of fields (fcst and obs) are masked to non-missing inside the fcst and obs super objects, and traditional mode is run on that pair of masked inputs producing uniquely named outputs. If it is FALSE, mode is not run for that pair of inputs.

If all **multivar_intensity** values are FALSE, the forecast and observation *super* objects are written to NetCDF, text, and postscript output files in the standard mode output format, but with no intensity information.

The **multivar_logic** configuration entry, described in :numref:`MODE-configuration-file`, defines the boolean logic for combining objects from multiple fields into a *super* object. If this configuration option is set, there must be an equal or greater number of fields defined in an array of dictionaries for it define a *super* object of more than one field. Note that the multi-variate MODE forecast and observation input fields and combination logic do not need to match. The resulting forecast and observation *super* objects are written to NetCDF output files. Users can then configure and run traditional MODE to compare the forecast super object to the observed super object.

Practical information
=====================
Expand Down Expand Up @@ -241,6 +245,32 @@ The **multivar_logic** entry is parsed separately from the **fcst** and **obs**

_____________________

.. code-block:: none

multivar_intensity = [FALSE, TRUE, TRUE];

The **multivar_intensity** entry appears only in the **MODEMultivarConfig_default** file. This option is paired with the **multivar_logic** entry, and can take on a value of TRUE or FALSE for each **field**. In the multivar case, super objects are created using the **multivar_logic** settings. For each input for which **multivar_intensity** is TRUE, the input is masked to be non-missing only within the super objects, and traditional mode is run on that masked input. For each input for which **multivar_intensity** is FALSE, the input is skipped over. If all the multivar_intensity values are FALSE, traditional mode output is created for the super objects, but with no intensity information.


_____________________

.. code-block:: none

multivar_name = "Precip";

The **multivar_name** entry appears only in the **MODEMultivarConfig_default** file. This option is used only when the multivar option is enabled, and only when all **multivar_intensity** flag values are FALSE. It can be thought of as an identifier for the multivariate super object. It shows up in output files names and content. If not set the default value is "Super". It can be set separately for forecasts and observations, or as a common value for both.


_____________________

.. code-block:: none

multivar_level = "LO";

The **multivar_level** entry appears only in the **MODEMultivarConfig_default** file. This option is used only when the multivar option is enabled, and only when all **multivar_intensity** flag values are FALSE. It is the identifier for the multivariate super object as regards level. It shows up in output files names and content. If not set the default value is "NA". It can be set separately for forecasts and observations, or as a common value for both.

_____________________

.. code-block:: none

fcst = {
Expand Down
14 changes: 12 additions & 2 deletions internal/test_unit/config/MODEConfig_multivar_fake_data
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ quilt = FALSE;
//
multivar_logic = "#1 && #2 && #3";

//
// MODE Multivar intensity logic
//
multivar_intensity_flag = [FALSE, FALSE, FALSE];

//
// Forecast and observation fields to be verified
//
Expand All @@ -63,16 +68,19 @@ fcst = {
{
name = "ALPHA";
level = "(*,*)";
merge_flag = NONE;
},

{
name = "BETA";
level = "(*,*)";
merge_flag = NONE;
},

{
name = "GAMMA";
level = "(*,*)";
merge_flag = NONE;
}

];
Expand All @@ -84,6 +92,8 @@ fcst = {
filter_attr_thresh = [];
merge_thresh = >=3.5;
merge_flag = NONE;
multivar_name = "Super";
multivar_level = "LO";
}
obs = fcst;

Expand All @@ -97,12 +107,12 @@ mask_missing_flag = NONE;
//
// Match objects between the forecast and observation fields
//
match_flag = NONE;
match_flag = MERGE_BOTH;

//
// Maximum centroid distance for objects to be compared
//
max_centroid_dist = 800.0/grid_res;
max_centroid_dist = 800.0;

////////////////////////////////////////////////////////////////////////////////

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
////////////////////////////////////////////////////////////////////////////////
//
// MODE configuration file.
//
// For additional information, please see the MET User's Guide.
//
////////////////////////////////////////////////////////////////////////////////

//
// Output model name to be written
//
model = "WRF";

//
// Output description to be written
//
desc = "NA";

//
// Output observation type to be written
//
obtype = "PRECIP";

////////////////////////////////////////////////////////////////////////////////

//
// Verification grid
//
regrid = {
to_grid = NONE;
method = NEAREST;
width = 1;
vld_thresh = 0.5;
shape = SQUARE;
}

////////////////////////////////////////////////////////////////////////////////

//
// Approximate grid resolution (km)
//
grid_res = 20;

////////////////////////////////////////////////////////////////////////////////

//
// Run all permutations of radius and threshold
//
quilt = FALSE;

//
// MODE Multivar boolean combination logic
//
multivar_logic = "#1 && #2 && #3";

//
// MODE Multivar intensity logic
//
multivar_intensity_flag = [TRUE, TRUE, TRUE];

//
// Forecast and observation fields to be verified
//
fcst = {

field = [

{
name = "ALPHA";
level = "(*,*)";
merge_flag = NONE;
},

{
name = "BETA";
level = "(*,*)";
merge_flag = NONE;
},

{
name = "GAMMA";
level = "(*,*)";
merge_flag = NONE;
}

];

conv_radius = 2; // in grid squares
conv_thresh = >=5.0;
vld_thresh = 0.5;
filter_attr_name = [];
filter_attr_thresh = [];
merge_thresh = >=3.5;
merge_flag = NONE;
multivar_name = "Super";
multivar_level = "LO";
}
obs = fcst;

////////////////////////////////////////////////////////////////////////////////

//
// Handle missing data
//
mask_missing_flag = NONE;

//
// Match objects between the forecast and observation fields
//
match_flag = MERGE_BOTH;

//
// Maximum centroid distance for objects to be compared
//
max_centroid_dist = 800.0;

////////////////////////////////////////////////////////////////////////////////

//
// Verification masking regions
//
mask = {
grid = "";
grid_flag = NONE; // Apply to NONE, FCST, OBS, or BOTH
poly = "";
poly_flag = NONE; // Apply to NONE, FCST, OBS, or BOTH
}

////////////////////////////////////////////////////////////////////////////////

//
// Fuzzy engine weights
//
weight = {
centroid_dist = 2.0;
boundary_dist = 4.0;
convex_hull_dist = 0.0;
angle_diff = 1.0;
aspect_diff = 0.0;
area_ratio = 1.0;
int_area_ratio = 2.0;
curvature_ratio = 0.0;
complexity_ratio = 0.0;
inten_perc_ratio = 0.0;
inten_perc_value = 50;
}

////////////////////////////////////////////////////////////////////////////////

//
// Fuzzy engine interest functions
//
interest_function = {

centroid_dist = (
( 0.0, 1.0 )
( 60.0/grid_res, 1.0 )
( 600.0/grid_res, 0.0 )
);

boundary_dist = (
( 0.0, 1.0 )
( 400.0/grid_res, 0.0 )
);

convex_hull_dist = (
( 0.0, 1.0 )
( 400.0/grid_res, 0.0 )
);

angle_diff = (
( 0.0, 1.0 )
( 30.0, 1.0 )
( 90.0, 0.0 )
);

aspect_diff = (
( 0.00, 1.0 )
( 0.10, 1.0 )
( 0.75, 0.0 )
);

corner = 0.8;
ratio_if = (
( 0.0, 0.0 )
( corner, 1.0 )
( 1.0, 1.0 )
);

area_ratio = ratio_if;

int_area_ratio = (
( 0.00, 0.00 )
( 0.10, 0.50 )
( 0.25, 1.00 )
( 1.00, 1.00 )
);

curvature_ratio = ratio_if;

complexity_ratio = ratio_if;

inten_perc_ratio = ratio_if;
}

////////////////////////////////////////////////////////////////////////////////

//
// Total interest threshold for determining matches
//
total_interest_thresh = 0.7;

//
// Interest threshold for printing output pair information
//
print_interest_thresh = 0.0;

////////////////////////////////////////////////////////////////////////////////

//
// Plotting information
//
met_data_dir = "MET_BASE";

fcst_raw_plot = {
color_table = "MET_BASE/colortables/met_default.ctable";
plot_min = 0.0;
plot_max = 25.4;
}

obs_raw_plot = {
color_table = "MET_BASE/colortables/met_default.ctable";
plot_min = 0.0;
plot_max = 25.4;
}

object_plot = {
color_table = "MET_BASE/colortables/mode_obj.ctable";
}

//
// Boolean for plotting on the region of valid data within the domain
//
plot_valid_flag = FALSE;

//
// Plot polyline edges using great circle arcs instead of straight lines
//
plot_gcarc_flag = FALSE;

////////////////////////////////////////////////////////////////////////////////

//
// NetCDF matched pairs, PostScript, and contingency table output files
//
ps_plot_flag = TRUE;
nc_pairs_flag = TRUE;
ct_stats_flag = TRUE;

////////////////////////////////////////////////////////////////////////////////

shift_right = 0; // grid squares

////////////////////////////////////////////////////////////////////////////////

output_prefix = "";
version = "V11.1.0";

////////////////////////////////////////////////////////////////////////////////
Loading