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

Merge develop (added tests) to main_v3.0 #416

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 0 additions & 8 deletions .coveragerc

This file was deleted.

23 changes: 3 additions & 20 deletions .github/workflows/trigger_metplus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- develop
- 'main_v[0-9]+.[0-9]+'
paths-ignore:
- 'docs/**'
- '.github/pull_request_template.md'
Expand All @@ -16,24 +17,6 @@ jobs:
name: Trigger METplus testing workflow
runs-on: ubuntu-latest
steps:
- name: Print GitHub values for reference
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/github-script@v7
- uses: dtcenter/metplus-action-trigger-use-cases@v1
with:
github-token: ${{ secrets.METPLUS_BOT_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'dtcenter',
repo: 'METplus',
workflow_id: 'testing.yml',
ref: 'develop',
inputs: {
repository: '${{ github.repository }}',
ref: '${{ github.ref }}',
actor: '${{ github.actor }}',
sha: '${{ github.sha }}',
pusher_email: '${{ github.event.pusher.email }}'
},
});
token: ${{ secrets.METPLUS_BOT_TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ For information about the support provided for releases, see our [Release Suppor
Instructions for installing the metcalcpy package locally
---------------------------------------------------------
- activate your conda environment (i.e. 'conda activate your-conda-env-name')
- from within your active conda environment, cd to the METcalcpy/ directory, where you will see the setup.py script
- from within your active conda environment, cd to the METcalcpy/ directory, where you will see the file pyproject.toml
- from this directory, run the following on the command line: pip install -e .
- the -e option stands for editable, which is useful in that you can update your METcalcpy/metcalcpy source without reinstalling it
- the . indicates that you should search the current directory for the setup.py script
- the . indicates that you should search the current directory for the pyproject.toml file.

- use metcalcpy package via import statement:
- Examples:
Expand Down
2 changes: 1 addition & 1 deletion docs/Users_Guide/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ METcalcpy source code, e.g. `/User/someuser/METcalcpy`. From this directory, ru

`pip install -e .`

This instructs pip to install the package based on instructios in the setup.py file located in the current directory
This instructs pip to install the package based on instructions in the pyproject.toml file located in the current directory
(as indicated by the '.'). The `-e` directs pip to install the package in edit mode, so if one wishes to make changes
bikegeek marked this conversation as resolved.
Show resolved Hide resolved
to this source code, the changes are automatically applied without the need to re-install the package.

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
copyright = '2024, NCAR'
author = 'UCAR/NCAR, NOAA, CSU/CIRA, and CU/CIRES'
author_list = 'Fisher, H., C. Kalb, D. Adriaansen, D. Fillmore, M. Win-Gildenmeister, T. Burek, M. Smith, and T. Jensen'
version = '3.0.0-rc1'
version = '3.0.0-dev'
verinfo = version
release = f'{version}'
release_year = '2024'
Expand Down
21 changes: 21 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ Boulder, CO

.. image:: _static/METplus_banner_photo_web.png

In Memoriam
-----------
This coordinated release is dedicated to three remarkable team members
we lost in 2024, whose contributions have left an indelible mark on our work.

To `Tara Jensen <https://dtcenter.org/news/2024/04#3032>`_,
for her vision and leadership in creating METplus as well as her
dedication, dogged determination, and mentorship that shaped its growth and
trajectory, leaving a legacy of innovation in the field of verification.

To `Randy Bullock <https://dtcenter.org/news/2024/04#3031>`_,
whose verification libraries formed the basis of MET and
whose mathematical brilliance, passion for maps, grid projections, and
graphics enriched and inspired new capabilities.

To `Venita Hagerty <https://sites.gsl.noaa.gov/authors/365>`_,
for her pivotal expertise, support, and attention to
detail that ensured the success of METdataio and METexpress.

Their contributions to METplus continue to guide and inspire us each day.

History
-------

Expand Down
2 changes: 1 addition & 1 deletion docs/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__="3.0.0-rc1"
3.0.0-beta1-dev
104 changes: 52 additions & 52 deletions metcalcpy/agg_stat_bootstrap.py

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions metcalcpy/pre_processing/directional_means.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
# ============================*



import numpy as np
import xarray as xr


def zonal_mean(dat,dimvar='longitude'):
Expand Down Expand Up @@ -52,10 +50,8 @@ def meridional_mean(dat, lat1, lat2, dimvar='latitude'):
"""

# Check inputs
if lat1 > lat2:
raise ValueError('lat1 is greater than lat2, but it must be less than lat2')
elif lat1 == lat2:
raise ValueError('lat1 is equal to lat2, but it must be less than lat2')
if lat1 >= lat2:
raise ValueError('lat1 is greater than or equal to lat2, but it must be less than lat2')

wgts = np.cos(np.deg2rad(dat[dimvar].where((dat[dimvar] >= lat1) & (dat[dimvar] <= lat2),drop=True)))

Expand Down
58 changes: 30 additions & 28 deletions metcalcpy/util/mode_3d_volrat_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"""
Program Name: mode_3d_volrat_statistics.py
"""
import numpy as np

from metcalcpy.util.mode_arearat_statistics import *
from metcalcpy.util.utils import column_data_by_name_value, THREE_D_DATA_FILTER
from metcalcpy.util.safe_log import safe_log
Expand Down Expand Up @@ -214,7 +216,7 @@ def calculate_3d_volrat_osm_osa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio OSM/OSA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -244,7 +246,7 @@ def calculate_3d_volrat_osu_osa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio OSU/OSA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -273,7 +275,7 @@ def calculate_3d_volrat_fsm_asm(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio FSM/ASM calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -303,7 +305,7 @@ def calculate_3d_volrat_osm_asm(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio OSM/ASM calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -333,7 +335,7 @@ def calculate_3d_volrat_osu_asu(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio OSU/ASU calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -363,7 +365,7 @@ def calculate_3d_volrat_fsa_aaa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio FSA/AAA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -393,7 +395,7 @@ def calculate_3d_volrat_osa_aaa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio OSA/AAA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -424,7 +426,7 @@ def calculate_3d_volrat_fsa_faa(input_data, columns_names, logger=None):

try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio FSA/FAA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -454,7 +456,7 @@ def calculate_3d_volrat_fca_faa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio FCA/FAA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -484,7 +486,7 @@ def calculate_3d_volrat_osa_oaa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio OSA/OAA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -514,7 +516,7 @@ def calculate_3d_volrat_oca_oaa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio OCA/OAA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -544,7 +546,7 @@ def calculate_3d_volrat_fca_aca(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio FCA/ACA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -574,7 +576,7 @@ def calculate_3d_volrat_oca_aca(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio OCA/ACA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -605,7 +607,7 @@ def calculate_3d_volrat_fsa_osa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio FSA/OSA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -636,7 +638,7 @@ def calculate_3d_volrat_osa_fsa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio OSA/FSA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -666,7 +668,7 @@ def calculate_3d_volrat_aca_asa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio ACA/ASA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -696,7 +698,7 @@ def calculate_3d_volrat_asa_aca(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio ASA/ACA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -727,7 +729,7 @@ def calculate_3d_volrat_fca_fsa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio FCA/FSA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -758,7 +760,7 @@ def calculate_3d_volrat_fsa_fca(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio FSA/FCA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -789,7 +791,7 @@ def calculate_3d_volrat_oca_osa(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio OCA/OSA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -820,7 +822,7 @@ def calculate_3d_volrat_osa_oca(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Ratio OSA/OCA calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -850,7 +852,7 @@ def calculate_3d_objvhits(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Hits calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -880,7 +882,7 @@ def calculate_3d_objvmisses(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Renaming columns for 3D Volume Misses calculation.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)

safe_log(logger, "debug", "Filtering data based on THREE_D_DATA_FILTER.")
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
Expand Down Expand Up @@ -909,7 +911,7 @@ def calculate_3d_objvfas(input_data, columns_names, logger=None):
or None if some of the data values are missing or invalid
"""
try:
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)
filtered_data = column_data_by_name_value(input_data, columns_names_new, THREE_D_DATA_FILTER)
result = calculate_objafas(filtered_data, columns_names_new)
except Exception as e:
Expand All @@ -933,7 +935,7 @@ def calculate_3d_objvcsi(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Starting the renaming of columns.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)
safe_log(logger, "debug", f"Renamed columns: {columns_names_new}")

safe_log(logger, "debug", "Filtering data based on the new column names.")
Expand Down Expand Up @@ -964,7 +966,7 @@ def calculate_3d_objvpody(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Starting the renaming of columns.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)
safe_log(logger, "debug", f"Renamed columns: {columns_names_new}")

safe_log(logger, "debug", "Filtering data based on the new column names.")
Expand Down Expand Up @@ -995,7 +997,7 @@ def calculate_3d_objvfar(input_data, columns_names, logger=None):
"""
try:
safe_log(logger, "debug", "Starting the renaming of columns.")
columns_names_new = rename_column(column_names, logger=logger)
columns_names_new = rename_column(columns_names, logger=logger)
safe_log(logger, "debug", f"Renamed columns: {columns_names_new}")

safe_log(logger, "debug", "Filtering data based on the new column names.")
Expand Down Expand Up @@ -1027,4 +1029,4 @@ def rename_column(columns_names, logger=None):
columns_names_new.insert(index, 'area')
else:
columns_names_new.insert(index, name)
return columns_names_new
return np.array(columns_names_new)
2 changes: 1 addition & 1 deletion metcalcpy/util/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def column_data_by_name_value(input_data, columns, filters):
try:
# for each filter
for key, value in filters.items():
# get an index og the column
# get an index of the column
index_array = np.where(columns == key)[0]
if index_array.size == 0:
return 0
Expand Down
Loading
Loading