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

Run Hurricane Matthew test case in METplus container #48

Closed
20 tasks
jaredalee opened this issue Feb 23, 2024 · 10 comments · Fixed by #53
Closed
20 tasks

Run Hurricane Matthew test case in METplus container #48

jaredalee opened this issue Feb 23, 2024 · 10 comments · Fixed by #53
Assignees
Labels
component: METplus METplus issues component: testing Software testing issues deliverable 1.2 Generate containers type: task An actionable item of work
Milestone

Comments

@jaredalee
Copy link
Contributor

Describe the Task

Using the WRF output generated by #46 and the observation data obtained in #47, generate some sample verification statistics with the METplus container. Document what commands/steps were used. This will also serve as another test to make sure that #5 is working properly.

Time Estimate

Estimate the amount of work required here.
Issues should represent approximately 1 to 3 days of work.

Sub-Issues

Consider breaking the task down into sub-issues.

  • Add a checkbox for each sub-issue here.

Relevant Deadlines

List relevant project deadlines here or state NONE.

Funding Source

7790013

Define the Metadata

Assignee

  • Select engineer(s) or no engineer required
  • Select scientist(s) or no scientist required

Labels

  • Select component(s)
  • Select priority
  • Select requestor(s)

Projects and Milestone

  • Select Repository and/or Organization level Project(s) or add alert: NEED PROJECT ASSIGNMENT label
  • Select Milestone as the next official version or Future Versions

Task Checklist

  • Complete the issue definition above, including the Time Estimate and Funding Source.
  • Fork this repository or create a branch of develop.
    Branch name: feature_<Issue Number>_<Description>
  • Complete the development and test your changes.
  • Add/update log messages for easier debugging.
  • Add/update unit tests.
  • Add/update documentation.
  • Push local changes to GitHub.
  • Submit a pull request to merge into develop.
    Pull request: feature <Issue Number> <Description>
  • Define the pull request metadata, as permissions allow.
    Select: Reviewer(s) and Development issues
    Select: Repository level development cycle Project for the next official release
    Select: Milestone as the next official version
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Close this issue.
@jaredalee
Copy link
Contributor Author

As a placeholder until the WRF output from the Hurricane Matthew test case from the container is available, the output from a standalone version of WRF for this case is here: /glade/derecho/scratch/jaredlee/nsf_i-wrf/matthew/wrf

@JohnHalleyGotway
Copy link
Contributor

JohnHalleyGotway commented Apr 19, 2024

@georgemccabe, @jaredalee, and @JohnHalleyGotway met on April 17th for a working session.

Steps:

run_metplus.py $METPLUS_PATH/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf config.OUTPUT_BASE=/glade/derecho/scratch/johnhg/METplus_output
  • Cat the run-specific log file for more details:
cat /glade/derecho/scratch/johnhg/METplus_output/logs/metplus.log.20240419161254
  • Could also run with a user-specific METplus config file and run with:
run_metplus.py $METPLUS_PATH/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf /glade/u/home/mccabe/mccabe.casper.conf 
  • Put user-specific settings last in the list to override any setting set in earlier configs.
  • Note that this i-wrf work requires using a METplus 6.0.0 beta version to read the WRF output on its native grid. But that has not yet been installed on casper.
  • Get started on a new use case by copying the example into a new file:
cp $METPLUS_PATH/parm/use_cases/met_tool_wrapper/PointStat/PointStat.conf /glade/u/home/mccabe/PointStat_iwrf_test.conf
  • Configure this conf file with Hurricane Matthew-specific times and settings.
  • Use template tags to update the input file paths.
  • Run METplus just to confirm that it's finding the WRF files in the spot we expect:
run_metplus.py /glade/u/home/mccabe/PointStat_iwrf_test.conf /glade/u/home/mccabe/mccabe.casper.conf
  • This run produces error message because MET-11.1.0 does not yet support native WRF output. Need to switch to MET-12.0.0-beta4.
    • @jprestop will install METplus-6.0.0-beta4 on casper for the i-wrf project during the week on April 22.
  • Once the Hurricane Matthew METplus config file is ready, we should store it in a new directory structure:
use_cases/
   - Hurricane_Matthew/ (Note: this the basic example from the WRF tutorial)
      - METplus/
      - WRF/
      - Visualization/
  - Land_Use_Land_Cover/
  - Renewable_Energy/
  - Air_Quality/
  • Note that the grid for this Hurricane Matthew test case is so coarse that it can't be run across more than 64 tiles anyway. And that's half of the 128 for a single Derecho node. So we cannot use this to demonstrate multi-node capability.
  • Since git won't allow empty directories, we should include a .gitignore file in each to demonstrate the proposed directory structure for the next project meeting.
  • Per @jaredalee, configure this use case to evaluate surface temperature, wind, and RH from METARS as well as verifying the same against radiosondes on the mandatory levels.

@georgemccabe
Copy link
Contributor

georgemccabe commented Apr 19, 2024

In branch https://github.com/NCAR/i-wrf/tree/feature/48_matthew_metplus, I created the directory structure for the use cases from @JohnHalleyGotway's comment above. I also committed the in-progress METplus configuration file for the Hurricane Matthew example. The config file has been set to read the WRF data (using a hard-coded path).

  • Set FCST template to read WRF data
  • Set OBS template to read observations
  • Set field information (FCST/OBS_VAR variables)
  • Install latest beta release for METplus 6.0.0
  • Ensure data can be read into MET successfully by running using beta
  • Set PointStat configurations to generate useful output statistics for metar obs
  • Set PointStat configurations to generate useful output statistics for raob obs
  • Fix METplus bug to read multiple observation files so we can read both metar and raob data: Bugfix: PointStat support multiple observations files dtcenter/METplus#2567 -- NOTE: a workaround was added to run 2 instances on PointStat so progress could continue without this fix being implemented

@jprestop
Copy link

jprestop commented Apr 24, 2024

@JohnHalleyGotway and @georgemccabe
The latest METplus beta releases are now installed on Casper. The Existing Builds page has been updated to reflected these installations. Please let me know if you have any questions or problems.

georgemccabe added a commit that referenced this issue Apr 26, 2024
@jaredalee
Copy link
Contributor Author

George & I just finished a working meeting, where we set up the METplus config file (in the commit referenced just above) to:

a) read in the WRF output file successfully
b) read in the METAR obs file successfully
c) read and calculate stats for 2-m T, 10-m U, and 10-m V as an initial test

We uncovered a bug in MET where it doesn't currently read in multiple obs files. George will create an issue and then fix that. Next time we'll add configurations to handle processing the RAOB obs file and determine if MET is properly interpolating native-grid WRF output to pressure levels, or if WRF needs to be re-run to output variables on specific pressure levels in a different file.

@JohnHalleyGotway
Copy link
Contributor

During the i-wrf tech team meeting on 5/3/24, @dudhia recommended the following:

  • Enhance the METplus container to include the GFDL Vortex Tracker.
  • Add a new METplus wrapper to make calls to the Vortex Tracker.
  • Enhance this Hurricane Matthew use case to run the tracker and then call the MET TC-Pairs tool to compare the atcfunix output track file to a B-deck for Hurricane Matthew.

Note that these changes are rather large and should probable be done via a separate issue.

For this issue while working on the hurricane Matthew instructions, please just scope out the idea, and if feasible, write up a separate issue to describe this potential future enhancement.

@georgemccabe
Copy link
Contributor

These notes expand on the previous comment and should be added to the new issue when it is created:

There is already a METplus wrapper for the GFDLTracker. I created a Docker image on DockerHub that contains the tracker that is used to run it for the METplus automated tests.

https://github.com/dtcenter/METplus/blob/develop/.github/actions/run_tests/Dockerfile.run_gfdl

This Dockerfile could be copied and modified to create a Docker container that includes METplus and the tracker.

The image created includes patches so it can be compiled using GCC instead of Intel. We could instead compile it using Intel since we already compile WRF using Intel. Here is the Dockerfile that builds the tracker using GCC:
https://github.com/dtcenter/METplus/blob/develop/internal/scripts/docker_env/Dockerfile.gfdl-tracker

@JohnHalleyGotway
Copy link
Contributor

Here's a list of recommended improvements to MET/METplus:

  1. In MET Point-Stat, we're requesting only VL1L2, not VCNT, but are getting a warning about computing wind direction stats for 0-vectors:
WARNING: VL1L2Info::compute_stats() -> Skipping 85 of 459 vector pairs for which the direction difference is undefined.
WARNING: Set the "wind_thresh" and "wind_logic" configuration options to exclude zero vectors.

Only warn about this when VCNT output is requested.

  1. In METplus PointStat wrapper, add support for setting wind_thresh and wind_logic that we used for this use case but are not currently supported by the wrapper. When this is added, you can replace the following override settings:
POINT_STAT_MET_CONFIG_OVERRIDES = wind_thresh   = [ >2 ]; wind_logic = INTERSECTION;
  1. Bugfix: PointStat support multiple observations files dtcenter/METplus#2567 to fix the Point-Stat wrapper bug for multiple observation files.

  2. New Wrapper: Madis2Nc dtcenter/METplus#1514 to create a MADIS2NC wrapper.

@georgemccabe
Copy link
Contributor

georgemccabe commented May 10, 2024

I was able to get a successful METplus run using apptainer on casper.

To load apptainer and pull the METplus image:

module load apptainer

cd ${SCRATCH}
apptainer pull docker://dtcenter/metplus:6.0.0-beta4

This creates a local file called metplus_6.0.0-beta4.sif.

Create local output directory:

mkdir ${SCRATCH}/metplus_out

Set environment variable to bind directories to container (note: this can also be accomplished by passing the value on the command line using the --bind argument)

  • Input data directories for WRF, raob, and metar input data
    • WRF: /glade/derecho/scratch/jaredlee/nsf_i-wrf/matthew to /data/input/wrf
    • raob: /glade/campaign/ral/wsap/i-wrf/data/hurr-matthew/madis/point/raob/netcdf to /data/input/obs/raob
    • metar: /glade/campaign/ral/wsap/i-wrf/data/hurr-matthew/madis/point/metar/netcdf to /data/input/obs/metar
  • Config directory containing METplus use case configuration file
    • /glade/u/home/mccabe/i-wrf/use_cases/Hurricane_Matthew/METplus to /config
  • Output directory to write output
    • ${SCRATCH}/metplus_out to /data/output
LOCAL_METPLUS_CONFIG_DIR=/glade/u/home/mccabe/i-wrf/use_cases/Hurricane_Matthew/METplus
LOCAL_FCST_INPUT_DIR=/glade/derecho/scratch/jaredlee/nsf_i-wrf/matthew
LOCAL_UPPER_AIR_OBS_INPUT_DIR=/glade/campaign/ral/wsap/i-wrf/data/hurr-matthew/madis/point/raob/netcdf
LOCAL_SURFACE_OBS_INPUT_DIR=/glade/campaign/ral/wsap/i-wrf/data/hurr-matthew/madis/point/metar/netcdf
LOCAL_OUTPUT_DIR=${SCRATCH}/metplus_out

export APPTAINER_BIND="${LOCAL_METPLUS_CONFIG_DIR}:/config,${LOCAL_FCST_INPUT_DIR}:/data/input/wrf,${LOCAL_UPPER_AIR_OBS_INPUT_DIR}:/data/input/obs/raob,${LOCAL_SURFACE_OBS_INPUT_DIR}:/data/input/obs/metar,${LOCAL_OUTPUT_DIR}:/data/output"

Execute the run_metplus.py command inside the container to run the use case:

apptainer exec metplus_6.0.0-beta4.sif /metplus/METplus/ush/run_metplus.py /config/PointStat_matthew.conf

Check that the output data was created locally:

ls ${SCRATCH}/metplus_out/point_stat -1

point_stat_surface_360000L_20161007_120000V_cnt.txt
point_stat_surface_360000L_20161007_120000V.stat
point_stat_surface_360000L_20161007_120000V_vcnt.txt
point_stat_upper_air_360000L_20161007_120000V_cnt.txt
point_stat_upper_air_360000L_20161007_120000V.stat
point_stat_upper_air_360000L_20161007_120000V_vcnt.txt

If you need to run on casper outside of apptainer, you can override the input directory values with the actual paths on casper:

module use /glade/work/dtcrt/METplus/casper/components/METplus/installations/modulefiles
module load metplus/6.0.0-beta4

LOCAL_FCST_INPUT_DIR=/glade/derecho/scratch/jaredlee/nsf_i-wrf/matthew
LOCAL_UPPER_AIR_OBS_INPUT_DIR=/glade/campaign/ral/wsap/i-wrf/data/hurr-matthew/madis/point/raob/netcdf
LOCAL_SURFACE_OBS_INPUT_DIR=/glade/campaign/ral/wsap/i-wrf/data/hurr-matthew/madis/point/metar/netcdf
LOCAL_OUTPUT_DIR=${SCRATCH}/metplus_out2

run_metplus.py \
/glade/u/home/mccabe/i-wrf/use_cases/Hurricane_Matthew/METplus/PointStat_matthew.conf \
config.FCST_POINT_STAT_INPUT_DIR=${LOCAL_FCST_INPUT_DIR} \
surface.OBS_POINT_STAT_INPUT_DIR=${LOCAL_SURFACE_OBS_INPUT_DIR} \
upper_air.OBS_POINT_STAT_INPUT_DIR=${LOCAL_UPPER_AIR_OBS_INPUT_DIR} \
config.OUTPUT_BASE=${LOCAL_OUTPUT_DIR}

Resources:
Apptainer Quick Start
Apptainer Bind Paths and Mounts
dtcenter/metplus DockerHub tags
METplus 6.0 Existing Builds

@georgemccabe
Copy link
Contributor

georgemccabe commented May 17, 2024

I was able to create a Docker "artifact" that can be pulled and mounted using apptainer. This is what I had to do on casper to create it:

module load apptainer

To create volume (directory obs existed in current directory that contained observation data):

mksquashfs obs/ input_obs.squashfs
apptainer sif new input_obs.sif
apptainer sif add --datatype 4 --partarch 2 --partfs 1 --parttype 3 input_obs.sif input_obs.squashfs

To push volume sif (artifact) to DockerHub:

apptainer remote login --username georgemccabe oras://registry-1.docker.io
# enter authentication token
apptainer push -U input_obs.sif oras://registry-1.docker.io/ncar/iwrf:data-matthew-input-obs

Then to run I had to pull the artifact using oras, then bind it to container:

cd ${SCRATCH}
mkdir metplus_out

apptainer pull docker://dtcenter/metplus:feature_1514_madis2nc-pull_request

apptainer pull data-matthew-input-obs.sif oras://registry-1.docker.io/ncar/iwrf:data-matthew-input-obs

LOCAL_METPLUS_CONFIG_DIR=/glade/u/home/mccabe/i-wrf/use_cases/Hurricane_Matthew/METplus
LOCAL_FCST_INPUT_DIR=/glade/derecho/scratch/jaredlee/nsf_i-wrf/matthew
LOCAL_OUTPUT_DIR=${SCRATCH}/metplus_out

export APPTAINER_BIND="${LOCAL_METPLUS_CONFIG_DIR}:/config,${LOCAL_FCST_INPUT_DIR}:/data/input/wrf,${LOCAL_OUTPUT_DIR}:/data/output,data-matthew-input-obs.sif:/data/input/obs:image-src=/"

apptainer exec /glade/derecho/scratch/mccabe/metplus-dev_feature_1514_madis2nc-pull_request.sif /metplus/METplus/ush/run_metplus.py /config/PointStat_matthew.conf

Resources:

@georgemccabe georgemccabe linked a pull request May 21, 2024 that will close this issue
13 tasks
jaredalee pushed a commit that referenced this issue May 21, 2024
* per #48, create directory structure to store files needed for each use case example

* per #48, add in-progress METplus config file

* per #48, update use case config to read metar observations and compute statistompute statistics

* Configure 2 instances of PointStat to process surface and upper air separately (until dtcenter/METplus#2567 is completed). Adjust settings to produce more useful output, prevent wind vector warnings, filter out duplicate obs, define pressure levels, etc.

* change configuration to overwrite fcst level to avoid messy NetCDF level value and change output flag settings to get results that can be more easily plotted

* change input directory paths to paths that are expected inside the container that are mounted -- left paths on casper for reference

* process all forecast leads and pressure levels

* change obs window to prevent observations from being matched with multiple model files

* add file window to get multiple observation input files

* Per #48, add instructions to run METplus use case on HPC using apptainer

* update RTD documentation requirements to specify sphinx

* add JetBrains files

* add other requirements for documentation

* change to consistent format as other entries

* Reformat info about local and container paths that are mounted

* add WRF configuration files

* run MADIS2NC as part of the use case instead of using output from the tool

* updated instructions to obtain obs data from artifact stored on DockerHub instead of local directory

* updated instructions to use full paths instead of changing directories, added steps to clone i-wrf repo to get METplus config files

* removed commented lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: METplus METplus issues component: testing Software testing issues deliverable 1.2 Generate containers type: task An actionable item of work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants