From f4ca05f6b2ccceeb65e9d2d41299a5fb8e7c6941 Mon Sep 17 00:00:00 2001 From: cshartsough <56739562+cshartsough@users.noreply.github.com> Date: Fri, 15 Nov 2024 09:57:02 -0700 Subject: [PATCH] fix for special accumulation case where MASSDEN 0h field ends in '_1' (#247) * fix for special accumulation case where MASSDEN 0h field ends in '_1' * add whitespace to pass pylint test. * Update micromamba with guidance from migration link https://github.com/mamba-org/provision-with-micromamba#migration-to-setup-micromamba%60 * Try completely new syntax with the micromamba migration * 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. * more changes to hrrr_maps_tests from graphics_tests more changes to hrrr_maps_tests from graphics_tests, missed in last commit * one more hrrr_maps_test change another change from the graphics_tests side that needed to be brought over to hrrr_maps_tests. * more small edits to hrrr_maps_tests script taking out some bad syntax --------- Co-authored-by: Christina Holt <56881914+christinaholtNOAA@users.noreply.github.com> --- .github/workflows/graphics_tests.yml | 21 ++++++++------------- .github/workflows/hrrr_maps_tests.yml | 15 +++++---------- adb_graphics/datahandler/gribfile.py | 4 ++++ 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/.github/workflows/graphics_tests.yml b/.github/workflows/graphics_tests.yml index e2bc800..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 - uses: mamba-org/provision-with-micromamba@main + - 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-env: true - - name: Install pygraf environment - run: micromamba create -n pygraf -y -f /home/runner/work/pygraf/pygraf/environment.yml + cache-environment: true - 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} diff --git a/.github/workflows/hrrr_maps_tests.yml b/.github/workflows/hrrr_maps_tests.yml index f02f788..40f6791 100644 --- a/.github/workflows/hrrr_maps_tests.yml +++ b/.github/workflows/hrrr_maps_tests.yml @@ -41,19 +41,14 @@ jobs: https://noaa-hrrr-bdp-pds.s3.amazonaws.com/hrrr.20230315/conus/hrrr.t00z.wrfprsf12.grib2 EOF ls - - name: Install Micromamba with no environment - uses: mamba-org/provision-with-micromamba@main + - 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-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} diff --git a/adb_graphics/datahandler/gribfile.py b/adb_graphics/datahandler/gribfile.py index 0f818d5..92094c6 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 = [