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

make --closedcontourcmd resolution specific #824

Merged
merged 6 commits into from
Oct 15, 2024

Conversation

chengzhuzhang
Copy link
Contributor

@chengzhuzhang chengzhuzhang commented Jul 19, 2024

Description

TC detection threshold should be model data resolution depended, currently the pre-processing script is using a threshold for ne120, resulted small number of detected TC events in ne30 simulations. Now update to add resolution specific thresholds.
Note: this fix should bring into cdat migration branch, and zppy implementation.

The original closed contour criteria (--closedcontourcmd "PSL,300.0,4.0,0;_AVG(T200,T500),-0.6,4,0.30"):
requiring an increase in PSL of at least 300 Pa (3 hPa) within 4 Degree of the candidate node,
and a decrease in 200 and 500 hPa average air temperature of 0.6 K within 4 Degree of the node within 0.3 degree of the candidate with maximum air temperature.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

If applicable:

  • New and existing unit tests pass with my changes (locally and CI/CD build)
  • I have added tests that prove my fix is effective or that my feature works
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have noted that this is a breaking change for a major release (fix or feature that would cause existing functionality to not work as expected)

@chengzhuzhang
Copy link
Contributor Author

chengzhuzhang commented Jul 23, 2024

With --closedcontourcmd "PSL,300.0,4.0,0;_AVG(T200,T500),-0.6,4,0.30" change into --closedcontourcmd "PSL,300.0,4.0,0;_AVG(T200,T500),-0.6,4,1.0", both threshold somehow created same results.
image

Changing --closedcontourcmd "PSL,300.0,4.0,0;_AVG(T200,T500),-0.6,4,1.0"
to --closedcontourcmd "PSL,300.0,4.0,0;_AVG(T200,T500),-0.6,4,1.2", slightly modified the distribution.
image

@chengzhuzhang
Copy link
Contributor Author

Below is a comparison between v3.LR and the base line simulation (v2ish)
image
With threshold 1.0 only 5 events are detected in 15 years of data LR v3.historical (2000-2014). Results are similar with threshold 0.3.

With the investigation so far, it is determined that:

  • At LR, the detection is largely insensitive to the threshold change.
  • With same threshold, v3.LR detected much less storms than in v2ish simulation with this algorithm.
  • We should test when v3.HR data made available.

GenerateVolumetricMesh --in ${result_dir}outCSne$res.g --out ${result_dir}outCSne$res.g --np 2 --uniform
# For v2 and v3 production simulation with pg2 grids:
GenerateCSMesh --res $res --alt --file ${result_dir}outCSMeshne$res.g
GenerateVolumetricMesh --in ${result_dir}outCSMeshne$res.g --out ${result_dir}outCSne$res.g --np 2 --uniform
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--in and --out file names were the same before, which I suspect caused the intermittent issue when mesh file can't be written on cfs.

DetectNodes --verbosity 0 --in_connect ${result_dir}connect_CSne${res}_v2.dat --closedcontourcmd "PSL,300.0,4.0,0;_AVG(T200,T500),-0.6,4,0.30" --mergedist 6.0 --searchbymin PSL --outputcmd "PSL,min,0;_VECMAG(UBOT,VBOT),max,2" --timestride 1 --in_data_list ${result_dir}inputfile_${file_name}.txt --out ${result_dir}out.dat

# --closedcontourcmd threshold is resolution depended.
if [ $res == 120 ]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines onward set DetectNodes command line resolution depended with the last parameter in --closedcontourcmd

HistogramNodes --in ${result_dir}cyclones_stitch_${file_name}.dat --iloncol 2 --ilatcol 3 --out ${result_dir}cyclones_hist_${file_name}.nc

# Calculate relative vorticity
sed -i 's/.nc/_vorticity.nc/' ${result_dir}outputfile_${file_name}.txt
#/global/homes/p/paullric/tempestextremes/bin/VariableProcessor --in_data_list ${result_dir}inputfile_${file_name}.txt --out_data_list ${result_dir}outputfile_${file_name}.txt --var "_CURL{4,0.5}(U850,V850)" --varout "VORT" --in_connect ${result_dir}connect_CSne${res}_v2.dat
sed -i 's/\.nc/_vorticity.nc/' ${result_dir}outputfile_${file_name}.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update sed command line to recognize special character ., this bug was discovered when nc is included in the case name in addition as the format name at the end.

@chengzhuzhang chengzhuzhang marked this pull request as ready for review October 15, 2024 18:01
@chengzhuzhang
Copy link
Contributor Author

@forsyth2 Just a heads-up that I updated the pre-processing script for TC detection, so that the detection is model resolution specific. Also the bug that the mesh generation file can't be written to cfs directories should also be fixed. We should plan to update zppy accordingly with these changes.

@forsyth2
Copy link
Collaborator

@chengzhuzhang How would you like me to review this PR?

  • Visual inspection?
  • Testing this myself?
  • Implementing corresponding changes in zppy and testing those?

@chengzhuzhang
Copy link
Contributor Author

Visual inspection would be nice. Mostly, it is a heads-up that we should propagate this change to zppy, and hopefully can resolve some recent issues with the tc_analysis in zppy.

Copy link
Collaborator

@forsyth2 forsyth2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from visual inspection thanks. I'll make/test the corresponding changes in zppy too (which might even help with E3SM-Project/zppy#180 & E3SM-Project/zppy#622)

Comment on lines -14 to -17
# Warning: because somehow tempest-remap only can writes grid file on SCRATCH space. The resulted files will be moved to another path at the end.
result_dir_fin=/global/cfs/cdirs/e3sm/e3sm_diags/postprocessed_e3sm_v2_data_for_e3sm_diags/${caseid}/
mkdir -p $result_dir_fin
result_dir=$SCRATCH/tests/tc-analysis/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With Perlmutter, we don't need to use $SCRATCH anymore? For zppy, we were using it for all machines:

# Warning: tempest-remap can only write grid file on SCRATCH space.
# The result files will be moved to another path at the end.
result_dir_fin={{ output }}/post/atm # Directory will be {{ output }}/post/atm/tc-analysis_${Y1}_${Y2}
mkdir -p $result_dir_fin
y1={{ year1 }}
y2={{ year2 }}
Y1="{{ '%04d' % (year1) }}"
Y2="{{ '%04d' % (year2) }}"
result_dir={{ scratch }}/tc-analysis_${Y1}_${Y2}/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe we don't need to use scratch any more, with fixing over-writing mesh file. At least, my tests worked okay.

@chengzhuzhang
Copy link
Contributor Author

Looks good from visual inspection thanks. I'll make/test the corresponding changes in zppy too (which might even help with E3SM-Project/zppy#180 & E3SM-Project/zppy#622)

Thanks! @forsyth2

@chengzhuzhang chengzhuzhang merged commit 6b0a245 into main Oct 15, 2024
4 checks passed
@chengzhuzhang chengzhuzhang deleted the res_specific_TC_detection branch October 15, 2024 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants