dtcenter / MET

Model Evaluation Tools
https://dtcenter.org/community-code/model-evaluation-tools-met
Apache License 2.0
77 stars 24 forks source link

Further refine TC-Diag tool functionality #2729

Open JohnHalleyGotway opened 10 months ago

JohnHalleyGotway commented 10 months ago

Describe the Enhancement

TC-Diag development history:

  1. MET-12.0.0-beta2: Issue #2550 and PR #2728 enhanced the TC-Diag tool to actually compute tropical cyclone diagnostics and write output files.
  2. MET-12.0.0-beta3: Issue #2769 and PR #2812 updated the Python driver code, addressed unit issues, and fixed the diagnostic file formatting.
  3. Note that issue #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:

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

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

Labels

Milestone and Projects

Define Related Issue(s)

Consider the impact to the other METplus components.

Enhancement Checklist

See the METplus Workflow for details.

JohnHalleyGotway commented 9 months ago

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

JohnHalleyGotway commented 9 months ago

@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 commented 9 months ago

@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 commented 9 months ago

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

1) Missing SHR_MAG, SHR_HDG, TGRDvalues: 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 shearand TGRDentries 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 200DVRGvalues: 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_Z10variables differ more significantly. I suspect that the wind vectors are simply more noisy so differences in resampling methods may make a larger difference.

JohnHalleyGotway commented 9 months ago

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 commented 7 months ago

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.
  2. 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 commented 6 months ago

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)