Skip to content

Commit 104162a

Browse files
authored
Merge pull request #290 from NOAA-CSL/develop
Merge Develop to Main
2 parents 13610f7 + b243d09 commit 104162a

File tree

115 files changed

+63319
-445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+63319
-445
lines changed

.github/workflows/ci.yml

+33-16
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,19 @@ jobs:
1717
strategy:
1818
matrix:
1919
monet: [cf, dev]
20-
fail-fast: false # just until cf versions are working
20+
fail-fast: false # always both
2121

2222
steps:
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424

2525
- name: Set up Python (micromamba)
26-
uses: mamba-org/provision-with-micromamba@v15
26+
uses: mamba-org/setup-micromamba@v1
2727
with:
2828
environment-file: docs/environment-docs.yml
29-
cache-env: true
30-
extra-specs: |
29+
cache-environment: true
30+
create-args: >-
3131
pytest
3232
33-
- name: Install MM
34-
run: python -m pip install -e . --no-deps -v
35-
3633
- if: ${{ matrix.monet == 'dev' }}
3734
name: Install development versions of monet and monetio
3835
run: |
@@ -49,25 +46,45 @@ jobs:
4946
python -c "import monet; print('monet.__version__', getattr(monet, '__version__', '?'))"
5047
5148
- name: pytest
52-
run: python -m pytest melodies_monet
49+
run: python -m pytest -v -rsx melodies_monet
5350

5451
- name: Run docs/examples notebooks as scripts
5552
run: |
5653
cd docs/examples
5754
for f in *.ipynb; do
5855
if [ "$f" == 'idealized.ipynb' ]; then
59-
jupytext --to py $f -o t.py
60-
python t.py
56+
jupytext --to py $f -o t.py && python t.py || exit 1
6157
fi
6258
done
6359
cd -
6460
61+
- name: Prepare idealized save/read cases
62+
shell: python
63+
run: |
64+
from copy import deepcopy
65+
import yaml
66+
67+
with open('docs/examples/control_idealized.yaml') as f:
68+
ctl = yaml.safe_load(f)
69+
assert {'save', 'read'} < ctl['analysis'].keys()
70+
71+
ctl_save = deepcopy(ctl)
72+
del ctl_save['analysis']['read']
73+
with open('docs/examples/control_idealized_save.yaml', 'w') as f:
74+
yaml.safe_dump(ctl_save, f)
75+
76+
ctl_read = deepcopy(ctl)
77+
del ctl_read['analysis']['save']
78+
with open('docs/examples/control_idealized_read.yaml', 'w') as f:
79+
yaml.safe_dump(ctl_read, f)
80+
6581
- name: Check CLI works
6682
run: |
6783
cd docs/examples
6884
melodies-monet --version
6985
python -m melodies_monet --version
70-
melodies-monet run control_idealized.yaml
86+
melodies-monet run control_idealized_save.yaml
87+
melodies-monet run control_idealized_read.yaml
7188
cd -
7289
7390
docs:
@@ -78,13 +95,13 @@ jobs:
7895
shell: bash -l {0}
7996

8097
steps:
81-
- uses: actions/checkout@v3
98+
- uses: actions/checkout@v4
8299

83100
- name: Set up Python (micromamba)
84-
uses: mamba-org/provision-with-micromamba@v12
101+
uses: mamba-org/setup-micromamba@v1
85102
with:
86103
environment-file: docs/environment-docs.yml
87-
cache-env: true
104+
cache-environment: true
88105

89106
- name: linkcheck
90107
run: sphinx-build -b linkcheck docs docs/_build/linkcheck
@@ -107,7 +124,7 @@ jobs:
107124
runs-on: ubuntu-latest
108125

109126
steps:
110-
- uses: actions/checkout@v3
127+
- uses: actions/checkout@v4
111128

112129
- name: Check that .py files have the license header
113130
run: python3 ci/check-for-license-header.py
Loading

docs/appendix/machine-specific-install.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Machine-specific Install
22
========================
33

4-
NCAR HPC Cheyenne/Casper
4+
NCAR HPC Derecho/Casper
55
------------------------
66

77
Below are specific recipes for getting started with MELODIES MONET
8-
on the NCAR HPC, Cheyenne/Casper.
8+
on the NCAR HPC, Derecho/Casper.
99

1010
**Official NCAR JupyterHub kernel**
1111

@@ -60,7 +60,7 @@ environment for running and developing MELODIES MONET.
6060
* You will need a NOAA HPC account to access the RDHPCS wiki link above.
6161

6262
* Both Anaconda/Miniconda will work well for MELODIES MONET. See
63-
`conda instructions <https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html#anaconda-or-miniconda>`__
63+
`conda instructions <https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html#installing-conda>`__
6464
to determine, which is the best option for you.
6565

6666
* Pick a directory for your download and run the following wget command with

docs/appendix/troubleshooting.rst

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Troubleshooting
2+
===============
3+
4+
Installation problems
5+
---------------------
6+
* Conda installation fails:
7+
* Often the problem is in the installation of wrf-python. Check that your computer does not have an Apple Silicon CPU (Apple Intel should be fine) and that the Python version is compatible with the wrf-python Conda package.
8+
9+
Runtime issues
10+
--------------
11+
* Pairing (:meth:`~melodies_monet.driver.analysis.pair_models`) takes too long:
12+
* ``analysis.pair_models()`` is one of the most expensive functions in MELODIES MONET, and you might be running out of memory. If you have access to more RAM, try it with that. A Time Chunking functionality is being developed to deal with this issue. Check :doc:`/users_guide/time_chunking`.
13+
* The plots are not produced. The error message references ``leg.legendHandles``:
14+
* You are probably using Matplotlib 3.9+ with pandas 1.x. Downgrade Matplotlib to 3.8 (upgrading pandas should also work, but you might run into some incompatibilities for some specific functionalities, especially those related to downloading observational data with MONETIO. Check :doc:`/getting_started/installation`).
15+
* NaN does not exist, or pandas not detecting NaN values, etc:
16+
* In NumPy 2.x, ``np.NaN`` has been completely replaced by ``np.nan``. ``np.NaN`` is required by some versions of MONETIO. There are two solutions: (i) downgrading NumPy to previous versions (``'numpy<2'``) or (ii) upgrading MONETIO (``'monetio>=0.2.7'``). If you go with option (ii), you might need to use the _develop_ branch of MONETIO (this should make it into _stable_ soon).
17+
* Failure downoloading maps:
18+
* MELODIES-MONET uses Cartopy for mapping. Cartopy downloads shapefiles automatically to create the maps, and if you are offline or working on a machine with download restrictions, this might fail. Check :doc:`/appendix/machine-specific-install`. This is the situation for *NOAA HPC Hera*, and the solution discussed there should work.

docs/appendix/yaml.rst

+40-8
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ data (e.g., surf_only: True).
106106
Typically this is set at the horizontal resolution of your model * 1.5. Setting
107107
this to a smaller value will speed up the pairing process.
108108

109+
**apply_ak:** This is an optional argument used for pairing of satellite data. This
110+
should be set to True when application of satellite averaging kernels or apriori data
111+
to model observations is desired.
112+
109113
**mapping:** This is the mapping dictionary for all variables to be plotted.
110114
For each observational dataset, add a mapping dictionary where the model
111115
variable name is first (i.e., key) and the observation variable name is second
@@ -181,7 +185,7 @@ Generalizing this to include other surface observations is under development.
181185
**filename:** The file directory location and name. These observations need
182186
to be preprocessed prior to incorporating them into MELODIES MONET.
183187
Shell variables prefixed with the ``$`` symbol, such as ``$HOME``, will be expanded.
184-
See :doc:`../tutorial/downloading_obs` for more details.
188+
See :doc:`../getting_started/downloading_obs` for more details.
185189

186190
**obs_type:** The observation type. Options are: "pt_sfc" or point surface. Adding
187191
options for Aircraft and Satellite observations are under development.
@@ -227,7 +231,7 @@ nan_values are set to NaN first and then the unit conversion is applied.
227231
(in %) is used to calculate the percentile (e.g., 5, 50, 95). Currently only
228232
used for "spatial_bias" plots. Will work with data as is and regulatory metrics.
229233
* **regulatory:** If false (default), use data as is. If set to true, the
230-
regulatory metric is calculated as explained under :doc:`/background/supported_analyses`.
234+
regulatory metric is calculated as explained under :doc:`/users_guide/supported_diagnostics`.
231235
Only works for "OZONE" and "PM2.5" variables.
232236
* **ylabel_reg_plot:** String to use as ylabel in plot for regulatory calculation.
233237
Useful for adding units or instrument information. Only used if regulatory = True.
@@ -272,15 +276,15 @@ Plots
272276
-----
273277
All input for each plotting group. A plotting group consists of one plotting
274278
type. The plotting types are described in
275-
:doc:`/background/supported_plots`. All model /
279+
:doc:`/users_guide/supported_plots`. All model /
276280
observational pairs and domains specified for the plotting group will be
277281
included. You may include as many plotting groups as you like.
278282

279283
For each plotting group, update the label and include the following information.
280284
Note: the labels need to be unique, but otherwise are not used.
281285

282286
**type:** The plot type. Options are: "timeseries", "taylor", "spatial_bias",
283-
"spatial_overlay", "spatial_bias_exceedance", and "boxplot"
287+
"spatial_overlay", "spatial_bias_exceedance", "boxplot", "multi-boxplot","csi"
284288
Note: "spatial_bias_exceedance" plots only work when regulatory = True.
285289

286290
**fig_kwargs:** This is optional to provide a dictionary with figure
@@ -313,12 +317,40 @@ For example, ::
313317
**domain_type:** List of domain types to be plotted. These correspond with
314318
the columns in the observation file. (e.g., airnow: epa_region, state_name,
315319
siteid, etc.).
320+
For automatic EPA or Giorgi region boxes (if they are not included
321+
with the columns in the observation file), choose ``auto-region:epa`` or
322+
``auto-region:giorgi``. Take into account that ``auto-region:epa`` is only a rough
323+
approximation, since it assumes perfect, rectangular lonlat boxes.
316324

317325
**domain_name:** List of domain names to be plotted. If domain_type = all, all
318326
data will be used and the domain_name is used only in the plot title. If
319327
domain_type is not equal to all, MELODIES MONET will query all of the data
320328
where domain_type is equal to domain_name.
321329

330+
**region_name:** list of source of regions used in title.
331+
(e.g., ['epa_region'])
332+
333+
**region_list:** list of regions we will calculate for scorecard.
334+
(e.g., ['R1','R2','R3','R4','R5','R6','R7','R8','R9','R10']
335+
336+
**urban_rural_name:** list of only one string input, which is variable used to
337+
determine wheter urban or rural site. (e.g., ['msa_name'])
338+
339+
**urban_rural_differentiate_value:** string of value used to determine whether
340+
variable is rural or urban. (e.g., '').
341+
342+
**better_or_worse_method:** string of method used to determine which models
343+
is better compared to observations. (e.g., 'RMSE', 'IOA' ,' NMB', 'NME'). choose
344+
one only for each time scorecard code run.
345+
346+
**model_name_list:**
347+
for multi-box plot, list of observation and model names user choose to set as x-labels;
348+
for csi plot, list of model names (only) user choose to set as labels.
349+
350+
**threshold_list:** csi plot only. list of values used as x variables. example: [10,20,30,40,50,60,70,80,90,100]
351+
352+
**score_name:** csi plot only. list of scores user can choose to plot. examples are "Critical Success Index' 'False Alarm Rate' 'Hit Rate'.
353+
322354
**data:** This a list of model / observation pairs to be plotted where the
323355
observation label is first and the model label is second
324356
(e.g., ['airnow_cmaq_expt', 'airnow_rrfs_13km', 'airnow_wrfchem_v4.2'])
@@ -362,14 +394,14 @@ observation label is first and the model label is second
362394
used for averaging and plotting. Options are 'time' for UTC or 'time_local'
363395
for local time
364396
* **ts_avg_window:** This is for timeseries plots only. This is the averaging
365-
window applied to the data. Options are None for no averaging or a pandas
366-
resample rule (e.g., 'H' is hourly, 'D' is daily).
397+
window applied to the data. No averaging done if not provided in the yaml file (i.e., ts_avg_window is optional). Averaging is done if a pandas
398+
resample rule (e.g., 'H' is hourly, 'D' is daily) is specified.
367399

368400
Stats
369401
-----
370402
All input needed to calculate the statistics. The supported statistics available
371403
in MELODIES MONET are described in
372-
:doc:`/background/supported_stats`. All model /
404+
:doc:`/users_guide/supported_stats`. All model /
373405
observational pairs and domains specified will be included. You may include as
374406
many statistics as you like. Note however that the calculation of the statistics
375407
is relatively slow right now. Optimizing this code is under development.
@@ -379,7 +411,7 @@ use Kelvin. Wind direction has special calculations for AirNow if the observatio
379411
name is 'WD'.
380412

381413
**stat_list:** List of acronyms of statistics to calculate as defined in
382-
:doc:`/background/supported_stats`. (e.g., ['MB', 'MdnB',
414+
:doc:`/users_guide/supported_stats`. (e.g., ['MB', 'MdnB',
383415
'NMB', 'NMdnB','R2', 'RMSE']). A dictionary of definitions is also included in
384416
MELODIES-MONET/melodies_monet/stats/proc_stats.py.
385417

docs/cli.rst

+11
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ any Python code::
1515
* |run|_ -- run a control file
1616
* |get-airnow|_ -- get AirNow data
1717
* |get-aeronet|_ -- get AERONET data
18+
* |get-aqs|_ -- get AQS data
19+
* |get-ish|_ -- get ISH data
20+
* |get-ish-lite|_ -- get ISH-Lite data
1821

1922
.. |run| replace:: ``run``
2023
.. _run: #melodies-monet-run
@@ -25,6 +28,14 @@ any Python code::
2528
.. |get-aeronet| replace:: ``get-aeronet``
2629
.. _get-aeronet: #melodies-monet-get-aeronet
2730

31+
.. |get-aqs| replace:: ``get-aqs``
32+
.. _get-aqs: #melodies-monet-get-aqs
33+
34+
.. |get-ish| replace:: ``get-ish``
35+
.. _get-ish: #melodies-monet-get-ish
36+
37+
.. |get-ish-lite| replace:: ``get-ish-lite``
38+
.. _get-ish-lite: #melodies-monet-get-ish-lite
2839

2940
.. click:: melodies_monet._cli:_typer_click_object
3041
:prog: melodies-monet

docs/conf.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
]
4141

4242
extlinks = {
43-
'issue': ('https://github.com/noaa-csl/melodies-monet/issues/%s', 'GH'),
44-
'pull': ('https://github.com/noaa-csl/melodies-monet/pull/%s', 'PR'),
43+
'issue': ('https://github.com/noaa-csl/melodies-monet/issues/%s', 'GH %s'),
44+
'pull': ('https://github.com/noaa-csl/melodies-monet/pull/%s', 'PR %s'),
4545
}
4646

4747
autosummary_generate = True # default in Sphinx v4
@@ -88,7 +88,7 @@
8888
#
8989
# This is also used if you do content translation via gettext catalogs.
9090
# Usually you set "language" from the command line for these cases.
91-
language = None
91+
language = 'en'
9292

9393
# List of patterns, relative to source directory, that match files and
9494
# directories to ignore when looking for source files.
@@ -198,7 +198,10 @@
198198
"https://www2.cisl.ucar.edu/resources/conda-environments",
199199
# Sphinx 4.5 linkcheck having problem:
200200
"https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account",
201+
# NCEI sites having problems
202+
"https://www.ncdc.noaa.gov/crn/",
201203
]
204+
user_agent = "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
202205

203206
autosectionlabel_prefix_document = True
204207
autosectionlabel_maxdepth = 2

docs/develop/contribute.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ the contributions and support from you.
1111
- Please check out
1212
`GitHub Projects <https://github.com/NOAA-CSL/MELODIES-MONET/projects>`__
1313
to learn about current development plans.
14-
- Join an :ref:`Upcoming Workshop <develop/workshops:Upcoming>`
15-
or check out :ref:`Past Workshops <develop/workshops:Past>`.
14+
- Join an :ref:`Upcoming Workshop <develop/other_resources:Upcoming>`
15+
or check out :ref:`Past Workshops <develop/other_resources:Past>`.
1616
- See our developers guide, to learn
1717
:ref:`develop/developers_guide:How to incorporate updates to MELODIES MONET`.
1818
- Email [email protected] with questions.

docs/develop/datasets.rst

+55
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,58 @@ While a part of the MONETIO repository,
2121
the private MELODIES MONET readers are designated with prefix ``_mm``.
2222

2323
Support for additional models is also under developed.
24+
25+
Standard variables are required to be computed in each model reader for each capability including surface, aircraft, and satellite as specified in the table below.
26+
27+
.. list-table:: Required Variables for Model Readers
28+
:widths: 10 30 30 30
29+
:header-rows: 1
30+
31+
* - Capability
32+
- | Variable Name
33+
| in Code
34+
- Description
35+
- Additional Requirements
36+
* - Surface
37+
- | ``time``
38+
| ``latitude``
39+
| ``longitude``
40+
- | Time in ``datetime64[ns]`` format
41+
| Latitude in degrees
42+
| Longitude in degrees
43+
- | Provide only surface model data
44+
| or if provide vertical model data,
45+
| first level must be the level
46+
| nearest to the surface.
47+
| All gases are in ppb and
48+
| all aerosols are in µg/m3.
49+
* - Aircraft
50+
- | ``time``
51+
| ``latitude``
52+
| ``longitude``
53+
| ``pres_pa_mid``
54+
| ``temperature_k``
55+
- | Time in ``datetime64[ns]`` format
56+
| Latitude in degrees
57+
| Longitude in degrees
58+
| Mid-level pressure in pascals (Pa)
59+
| Mid-level temperature in kelvin (K)
60+
- | Provide vertical model data.
61+
| All gases are in ppb and
62+
| all aerosols are in µg/m3.
63+
* - Satellites
64+
- | ``time``
65+
| ``latitude``
66+
| ``longitude``
67+
| ``pres_pa_mid``
68+
| ``temperature_k``
69+
| ``dz_m``
70+
| ``surfpres_pa``
71+
- | Time in ``datetime64[ns]`` format
72+
| Latitude in degrees
73+
| Longitude in degrees
74+
| Mid-level pressure in pascals (Pa)
75+
| Mid-level temperature in kelvin (K)
76+
| Layer thickness in meters (m)
77+
| Surface pressure in pascals (Pa)
78+
- | Provide vertical model data.

0 commit comments

Comments
 (0)