From f7dbdcad947fae6d92c470c8f7db83376c4cf0d9 Mon Sep 17 00:00:00 2001 From: Craig Hartsough Date: Thu, 14 Nov 2024 14:55:17 +0000 Subject: [PATCH 1/8] fix for special accumulation case where MASSDEN 0h field ends in '_1' --- adb_graphics/datahandler/gribfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/adb_graphics/datahandler/gribfile.py b/adb_graphics/datahandler/gribfile.py index 0f818d5..b6174d4 100644 --- a/adb_graphics/datahandler/gribfile.py +++ b/adb_graphics/datahandler/gribfile.py @@ -101,6 +101,10 @@ def free_fcst_names(self, ds, fcst_type): if suffix in special_suffixes and needs_renaming: new_suffix = f'{suffix}1h' if 'global' not in self.model else f'{suffix}6h' ret[var] = var.replace(suffix, new_suffix) + # MASSDEN is a special case when ending in "avg_1'" + if var.split('_')[0] == 'MASSDEN' and var.split('_')[-2] == 'avg': + print(f'Special change to MASSDEN avg_1 name to avg1h_1') + ret[var] = var.replace('avg','avg1h') else: # Only rename these variables at late hours odd_variables = [ From 031c7e7c5b4531feb1fd9cc60b4d0d236714ad2f Mon Sep 17 00:00:00 2001 From: Craig Hartsough Date: Thu, 14 Nov 2024 15:12:33 +0000 Subject: [PATCH 2/8] add whitespace to pass pylint test. --- adb_graphics/datahandler/gribfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adb_graphics/datahandler/gribfile.py b/adb_graphics/datahandler/gribfile.py index b6174d4..92094c6 100644 --- a/adb_graphics/datahandler/gribfile.py +++ b/adb_graphics/datahandler/gribfile.py @@ -104,7 +104,7 @@ def free_fcst_names(self, ds, fcst_type): # MASSDEN is a special case when ending in "avg_1'" if var.split('_')[0] == 'MASSDEN' and var.split('_')[-2] == 'avg': print(f'Special change to MASSDEN avg_1 name to avg1h_1') - ret[var] = var.replace('avg','avg1h') + ret[var] = var.replace('avg', 'avg1h') else: # Only rename these variables at late hours odd_variables = [ From b5fb824c97cf6812e741692db9161ba6d67c2c37 Mon Sep 17 00:00:00 2001 From: Christina Holt <56881914+christinaholtNOAA@users.noreply.github.com> Date: Thu, 14 Nov 2024 08:34:04 -0700 Subject: [PATCH 3/8] Update micromamba with guidance from migration link https://github.com/mamba-org/provision-with-micromamba#migration-to-setup-micromamba%60 --- .github/workflows/graphics_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/graphics_tests.yml b/.github/workflows/graphics_tests.yml index e2bc800..8fb8745 100644 --- a/.github/workflows/graphics_tests.yml +++ b/.github/workflows/graphics_tests.yml @@ -19,12 +19,12 @@ jobs: with: lfs: true - name: Install Micromamba with no environment - uses: mamba-org/provision-with-micromamba@main + uses: mamba-org/setup-micromamba@v1 with: environment-file: false channel-priority: flexible cache-downloads: true - cache-env: true + cache-environment: true - name: Install pygraf environment run: micromamba create -n pygraf -y -f /home/runner/work/pygraf/pygraf/environment.yml - name: Lint code From 0184e4bfeadfca9f4eb4a801f51113af052a75c7 Mon Sep 17 00:00:00 2001 From: Christina Holt <56881914+christinaholtNOAA@users.noreply.github.com> Date: Thu, 14 Nov 2024 08:41:55 -0700 Subject: [PATCH 4/8] Try completely new syntax with the micromamba migration --- .github/workflows/graphics_tests.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/graphics_tests.yml b/.github/workflows/graphics_tests.yml index 8fb8745..3fae546 100644 --- a/.github/workflows/graphics_tests.yml +++ b/.github/workflows/graphics_tests.yml @@ -18,20 +18,15 @@ jobs: uses: actions/checkout@v2 with: lfs: true - - name: Install Micromamba with no environment + - name: Install Micromamba with pygraf environment uses: mamba-org/setup-micromamba@v1 with: - environment-file: false - channel-priority: flexible + environment-file: environment.yml cache-downloads: true cache-environment: true - - name: Install pygraf environment - run: micromamba create -n pygraf -y -f /home/runner/work/pygraf/pygraf/environment.yml - name: Lint code - run: | - micromamba activate pygraf - find . -type f -name "*.py" | xargs pylint + run: find . -type f -name "*.py" | xargs pylint + shell: bash -el {0} - name: Test code - run: | - micromamba activate pygraf - python -m pytest --nat-file tests/data/wrfnat_hrconus_07.grib2 --prs-file tests/data/wrfprs_hrconus_07.grib2 --ignore=tests/test_hrrr_maps.py + run: python -m pytest --nat-file tests/data/wrfnat_hrconus_07.grib2 --prs-file tests/data/wrfprs_hrconus_07.grib2 --ignore=tests/test_hrrr_maps.py + shell: bash -el {0} From d46b1979a70d6e10e8f497b8ce6e637dfba4dde5 Mon Sep 17 00:00:00 2001 From: cshartsough <56739562+cshartsough@users.noreply.github.com> Date: Thu, 14 Nov 2024 12:26:50 -0700 Subject: [PATCH 5/8] Use micromamba changes from graphics_test in hrrr_maps_tests Craig added changes that Christina made for new micromamba syntax in graphics_tests here as well. --- .github/workflows/hrrr_maps_tests.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/hrrr_maps_tests.yml b/.github/workflows/hrrr_maps_tests.yml index f02f788..ed1e655 100644 --- a/.github/workflows/hrrr_maps_tests.yml +++ b/.github/workflows/hrrr_maps_tests.yml @@ -41,19 +41,17 @@ jobs: https://noaa-hrrr-bdp-pds.s3.amazonaws.com/hrrr.20230315/conus/hrrr.t00z.wrfprsf12.grib2 EOF ls - - name: Install Micromamba with no environment + - name: Install Micromamba with pygraf environment uses: mamba-org/provision-with-micromamba@main with: - environment-file: false - channel-priority: flexible + environment-file: environment.yml cache-downloads: true cache-env: true - - name: Install pygraf environment - run: micromamba create -n pygraf -y -f /home/runner/work/pygraf/pygraf/environment.yml - name: Test code run: | micromamba activate pygraf export GITHUB_WORKSPACE=$(pwd) export $data_loc export $output_loc - python -m pytest tests/test_hrrr_maps.py \ No newline at end of file + python -m pytest tests/test_hrrr_maps.py + shell: bash -el {0} From e917b443f7a9bcd310471e78123182b4dc603445 Mon Sep 17 00:00:00 2001 From: cshartsough <56739562+cshartsough@users.noreply.github.com> Date: Thu, 14 Nov 2024 12:33:03 -0700 Subject: [PATCH 6/8] more changes to hrrr_maps_tests from graphics_tests more changes to hrrr_maps_tests from graphics_tests, missed in last commit --- .github/workflows/hrrr_maps_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hrrr_maps_tests.yml b/.github/workflows/hrrr_maps_tests.yml index ed1e655..330f87c 100644 --- a/.github/workflows/hrrr_maps_tests.yml +++ b/.github/workflows/hrrr_maps_tests.yml @@ -42,7 +42,7 @@ jobs: EOF ls - name: Install Micromamba with pygraf environment - uses: mamba-org/provision-with-micromamba@main + uses: mamba-org/setup-micromamba@v1 with: environment-file: environment.yml cache-downloads: true From 05a1820fb7494ba4cae6b882fdb6fc5c35a06ada Mon Sep 17 00:00:00 2001 From: cshartsough <56739562+cshartsough@users.noreply.github.com> Date: Thu, 14 Nov 2024 12:41:08 -0700 Subject: [PATCH 7/8] one more hrrr_maps_test change another change from the graphics_tests side that needed to be brought over to hrrr_maps_tests. --- .github/workflows/hrrr_maps_tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/hrrr_maps_tests.yml b/.github/workflows/hrrr_maps_tests.yml index 330f87c..84488ea 100644 --- a/.github/workflows/hrrr_maps_tests.yml +++ b/.github/workflows/hrrr_maps_tests.yml @@ -49,7 +49,6 @@ jobs: cache-env: true - name: Test code run: | - micromamba activate pygraf export GITHUB_WORKSPACE=$(pwd) export $data_loc export $output_loc From eb9d69c83934b8ffdf010b87979522a0ea6945fa Mon Sep 17 00:00:00 2001 From: cshartsough <56739562+cshartsough@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:41:59 -0700 Subject: [PATCH 8/8] more small edits to hrrr_maps_tests script taking out some bad syntax --- .github/workflows/hrrr_maps_tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/hrrr_maps_tests.yml b/.github/workflows/hrrr_maps_tests.yml index 84488ea..40f6791 100644 --- a/.github/workflows/hrrr_maps_tests.yml +++ b/.github/workflows/hrrr_maps_tests.yml @@ -50,7 +50,5 @@ jobs: - name: Test code run: | export GITHUB_WORKSPACE=$(pwd) - export $data_loc - export $output_loc python -m pytest tests/test_hrrr_maps.py shell: bash -el {0}