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

Further refine TC-Diag tool functionality #2729

Open
8 of 32 tasks
JohnHalleyGotway opened this issue Nov 6, 2023 · 7 comments
Open
8 of 32 tasks

Further refine TC-Diag tool functionality #2729

JohnHalleyGotway opened this issue Nov 6, 2023 · 7 comments
Assignees
Labels
MET: Tropical Cyclone Tools priority: high High Priority requestor: NOAA/other NOAA Laboratory, not otherwise specified type: enhancement Improve something that it is currently doing
Milestone

Comments

@JohnHalleyGotway
Copy link
Collaborator

JohnHalleyGotway commented Nov 6, 2023

Describe the Enhancement

TC-Diag development history:

  1. MET-12.0.0-beta2: Issue Enhance TC-Diag to actually compute and write diagnostics #2550 and PR Feature #2550 compute_diagnostics #2728 enhanced the TC-Diag tool to actually compute tropical cyclone diagnostics and write output files.
  2. MET-12.0.0-beta3: Issue Enhance TC-Diag to use tc_diag_driver version 0.11.0 #2769 and PR Feature #2769 tc_diag_driver_v0.11.0 #2812 updated the Python driver code, addressed unit issues, and fixed the diagnostic file formatting.
  3. Note that issue Enhance TC-DLand to use updated NHC land definition data #2751 will also impact the TC-Diag tool but is documented as a separate issue.

The following tasks were not completed for #2769 and should be addressed during the beta4 development cycle:

  • Investigate why the computed diagnostics DO NOT MATCH @robertdemariacira. As discussed on 11/1/23:
    • It is OK if diag values differ by 1 due to rounding.
    • There are clearly problems with the winds.
    • @JohnHalleyGotway and @robertdemariacira will coordinate on testing/debugging.
  • Update unit_tc_diag.xml to run a realistic HWRF parent + nest example. Be sure to test with with and without MET_PYTHON_EXE set. Use Hurricane Ian example for which we have diagnostics output and @KathrynNewman is providing gridded HWRF test data. Note that d01 should be used as the "parent" and d03 as the "nest" data source.
  • MET-12.0.0-beta3 replaced writing temporary Python files in NetCDF format with JSON + NumPy serialization. TC-Diag still writes NetCDF cylindrical coordinate files for the Python tc_diag_driver code to read. Investigate whether or not this approach works on NOAA machines (like jet) where there was a NetCDF conflict. If not, consider always making a system call to Python (with MET_PYTHON_EXE set) rather than actually embedding it.

Additional task list (last updated based on Nov 29, 2023 project meeting):

  • Keep NetCDF variable long names consistent with the ones listed in this Google Doc. See @jvigh.
  • Enhance the NetCDF diagnostics output to report data in more typical units (e.g. use C rather than 10C). However, recommend keeping knots rather than switching to m/s.
  • Run the TC-Diag NetCDF output through the https://ioos.noaa.gov CF-convention compliance checker. It may not be possible to achieve full compliance, but recommend getting as close as reasonably possible.
  • Parallelize the processing of valid times. Simple OpenMP does not work. Global python instance is a problem.
  • Update documentation @JohnHalleyGotway:
    • Describe CIRA and NetCDF diag outputs.
    • Update Appendix F with TC-Diag python embedding info.
  • Review existing configuration options and documentation for details about vortex removal. Make any necessary updates since it will not be included in MET version 12.0. See issue Enhance TC-Diag to support vortex removal #2752.

Time Estimate

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

Sub-Issues

Consider breaking the enhancement down into sub-issues.
See related issues:

Relevant Deadlines

List relevant project deadlines here or state NONE.

Funding Source

2770043

Define the Metadata

Assignee

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

Labels

  • Review default alert labels
  • Select component(s)
  • Select priority
  • Select requestor(s)

Milestone and Projects

  • Select Milestone as the next official version or Backlog of Development Ideas
  • For the next official version, select the MET-X.Y.Z Development project

Define Related Issue(s)

Consider the impact to the other METplus components.

Enhancement Checklist

See the METplus Workflow for details.

  • 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 issue
    Select: Milestone as the next official version
    Select: MET-X.Y.Z Development project for development toward the next official release
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Close this issue.
@JohnHalleyGotway JohnHalleyGotway added type: enhancement Improve something that it is currently doing requestor: NOAA/other NOAA Laboratory, not otherwise specified MET: Tropical Cyclone Tools priority: high High Priority labels Nov 6, 2023
@JohnHalleyGotway JohnHalleyGotway added this to the MET 12.0.0 milestone Nov 6, 2023
@JohnHalleyGotway JohnHalleyGotway self-assigned this Nov 6, 2023
@JohnHalleyGotway
Copy link
Collaborator Author

Here's a CF-compliance checker report provided by @jvigh:
IOOS Compliance Checker.pdf

@JohnHalleyGotway JohnHalleyGotway changed the title Further refine TC-Diag tool and support vortex removal Further refine TC-Diag tool functionality Nov 29, 2023
@JohnHalleyGotway
Copy link
Collaborator Author

@robertdemariacira and @musgrave-kate please find the sample data we discussed at the meeting on 11/29/23 in the following tar file on the RAL public ftp server:
ftp://ftp.rap.ucar.edu/incoming/irap/met_help/for_robert/tc_diag_test_case.tar.gz

This includes the inputs, outputs, and temp files I get when running TC-Diag. Please let me know if you have any questions.

Here's the contents of the run_tc_diag.sh script:

#!/bin/sh

TC_DIAG=/d1/projects/MET/MET_regression/develop/NB20231130/MET-develop/bin/tc_diag

echo "input/gfs/gfs.0p25.2022092400.f000.grib2 \
      input/gfs/gfs.0p25.2022092400.f006.grib2 \
      input/gfs/gfs.0p25.2022092400.f012.grib2 \
      input/gfs/gfs.0p25.2022092400.f018.grib2 \
      input/gfs/gfs.0p25.2022092400.f024.grib2" > input/gfs_2022092400_file_list;

${TC_DIAG} \
-deck input/adeck/aal092022_OFCL_SHIP_AVNO.dat \
-data parent GFSO input/gfs_2022092400_file_list \
-config config/TCDiagConfig_ian \
-outdir output \
-log run_tc_diag.log \
-v 4

And here's a full directory listing of the tar file contents:

ls -lah tc_diag_test_case/*
-rw-r--r-- 1 met_test rap 1.9M Nov 30 08:58 tc_diag_test_case/run_tc_diag.log
-rwxr-xr-x 1 met_test rap  568 Nov 30 08:54 tc_diag_test_case/run_tc_diag.sh

tc_diag_test_case/config:
total 12K
drwxr-sr-x 2 met_test rap 4.0K Nov 30 08:55 .
drwxr-sr-x 6 met_test rap 4.0K Nov 30 08:57 ..
-rw-r--r-- 1 met_test rap 3.5K Nov 30 08:55 TCDiagConfig_ian

tc_diag_test_case/input:
total 20K
drwxr-sr-x 4 met_test rap 4.0K Nov 30 08:57 .
drwxr-sr-x 6 met_test rap 4.0K Nov 30 08:57 ..
drwxr-sr-x 2 met_test rap 4.0K Nov 30 08:57 adeck
drwxr-sr-x 2 met_test rap 4.0K Nov 30 08:55 gfs
-rw-r--r-- 1 met_test rap  229 Nov 30 08:57 gfs_2022092400_file_list

tc_diag_test_case/output:
total 13M
drwxr-sr-x 2 met_test rap 4.0K Nov 30 08:58 .
drwxr-sr-x 6 met_test rap 4.0K Nov 30 08:57 ..
-rw-r--r-- 1 met_test rap  13M Nov 30 08:58 sal092022_gfso_doper_2022092400_cyl_grid_parent.nc
-rw-r--r-- 1 met_test rap  13K Nov 30 08:58 sal092022_gfso_doper_2022092400_diag.dat
-rw-r--r-- 1 met_test rap  48K Nov 30 08:58 sal092022_gfso_doper_2022092400_diag.nc

tc_diag_test_case/tmp:
total 14M
drwxr-sr-x 2 met_test rap 4.0K Nov 30 08:57 .
drwxr-sr-x 6 met_test rap 4.0K Nov 30 08:57 ..
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f0_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f102_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f108_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f114_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f120_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f126_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f12_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f18_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f24_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f30_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f36_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f42_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f48_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f54_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f60_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f66_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f6_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f72_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f78_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f84_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f90_parent_32767_0_.nc
-rw-r--r-- 1 met_test rap 642K Nov 30 08:58 tmp_tc_diag_AL092022_GFSO_2022092400_f96_parent_32767_0_.nc

@robertdemariacira
Copy link

@JohnHalleyGotway @musgrave-kate Got it! Thanks! Also, I believe we gave you some incorrect information about the way that resampling to the cylindrical grid works yesterday (and very possibly before that). The Fortran version of the code (as well as the other Python driver) actually use bilinear interpolation from the 4 closest samples not nearest neighbor interpolation. This may explain some of the differences in output values we've been getting. In any case, I'll be diving into this data while I do some debugging.

@robertdemariacira
Copy link

robertdemariacira commented Dec 8, 2023

@JohnHalleyGotway @musgrave-kate I have a new version (v0.11.0) of tc_diag_driver that addresses the following issues:

  1. Missing SHR_MAG, SHR_HDG, TGRD values:
    These computations reference the computed U, V diagnostic variables so when I changed their names from u, v to U, V these computations were not longer able to find the variables they needed. This is an easy fix. In the config files the shear and TGRD entries now reference U, V.

  2. Missing units:
    The code now initializes the returned Dataset variables with units defined in the config files so that even if a variable can not be computed, the returned Dataset will have all of the correct units. The div_vort_850 and div_vort_200 entries in the config files now have explicitly defined units of /S to ensure that these will appear in the returned results.

Check tests/post_resample_test/post_resample.yml and tests/post_resample_test/post_resample_nest.yml for relevant changes.

Remaining Issues:

  1. Missing 850TANG, 850VORT, and 200DVRG values:
    These values are not missing for me when I run the code locally on the provided input .nc files, so I'm not entirely sure why they're missing in the provided output.

  2. Differences in RMW and other values:
    I believe two different methods are being used to resample the input grib variables to cylindrical coordinates. The resampled variables in the provided temp .nc files differ from their counterparts in the Fortran/Python versions. In many variables, such as temperature, these differences are fairly minor. Temperature was usually only different by less than a degree, but in some cases was 5 degrees different. However, the UGRD, VGRD, UGRD_Z10, and VGRD_Z10 variables differ more significantly. I suspect that the wind vectors are simply more noisy so differences in resampling methods may make a larger difference.

@JohnHalleyGotway
Copy link
Collaborator Author

JohnHalleyGotway commented Dec 13, 2023

On 12/13/23 @robertdemariacira noted that we should switch from nearest neighbor interpolation to bilinear in the regrid dictionary of the TCDiagConfig_default file for consistency with the existing Fortran implementation.

@JohnHalleyGotway
Copy link
Collaborator Author

JohnHalleyGotway commented Feb 7, 2024

During the TC-Diag project meeting on Feb 7, 2024, we made the following decisions:

  1. The first two columns of the diagnostics (name, units), including the space between those entries, should have a total width of 16 characters.
  • Recommend that we remove the parenthesis surrounding the units string to have more space.
  • Revise the existing logic for checking the diagnostic name and units length, and instead enforce their combined length.
  1. Recommend running Python tc_diag_driver code with GRIB2 inputs and use this option to dump the cylindrical coordinate data.

During this meeting, we worked up a nice example that can be found in seneca:/d1/projects/TCDiag/al092022_test. The run_met.sh, run_python.sh, and run_python_dump.sh scripts run the MET TC-Diag tool and tc_diag_driver Python code directly to compute diagnostics using the exact same inputs. Dumping the cylindrical coordinate data, it looks like there's a pretty clear shift going on. Here's a screenshot to demonstrate. Across the top is the tc_diag_driver version of the cylindrical coordinates data for 850mb U wind. Down the left side is the MET output. Note that the values for (0,0) differ and there's a shift in the pattern of the red and blue blobs.
Screen Shot 2024-02-07 at 4 42 27 PM

@JohnHalleyGotway
Copy link
Collaborator Author

Tested TC-Diag and confirmed that azimuths are currently computed in degrees clockwise from north, as seen by lat/lon's computed for 4 azimuths. Relative to the center point, these points are north - east - south - west:

DEBUG 1: Range 5 = 500, Azimuth 0 = 0, (lat, lon) = (18.6916, 71.9)
DEBUG 1: Range 5 = 500, Azimuth 1 = 90, (lat, lon) = (14.1555, 76.5325)
DEBUG 1: Range 5 = 500, Azimuth 2 = 180, (lat, lon) = (9.70843, 71.9)
DEBUG 1: Range 5 = 500, Azimuth 3 = 270, (lat, lon) = (14.1555, 67.2675)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MET: Tropical Cyclone Tools priority: high High Priority requestor: NOAA/other NOAA Laboratory, not otherwise specified type: enhancement Improve something that it is currently doing
Projects
Status: 🏗 In progress
Development

No branches or pull requests

2 participants