-
Notifications
You must be signed in to change notification settings - Fork 16
Fix regex for tc_analysis #723
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8282f73
Fix regex for tc_analysis
forsyth2 51cfff8
Address comments
forsyth2 0d69d1b
fix another error that always use h2 as input stream
chengzhuzhang ccb7835
add condition for non-pg2 v1 files
chengzhuzhang 0bc4974
Clean up code
forsyth2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,18 +30,20 @@ topography_file=`echo $(ncks --trd -M -m ${first_file} | grep -E -i "^global att | |
| echo "topography_file=${topography_file}" | ||
| res={{ res }} | ||
| pg2=false | ||
| if [[ $topography_file =~ /[^_]*_([^_]*)_.*nc ]]; then | ||
| grid=${BASH_REMATCH[1]} | ||
| filename="${topography_file##*/}" | ||
| echo "filename=${filename}" | ||
| if [[ $filename =~ ne[0-9]+np4pg2+ ]]; then | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chengzhuzhang I implemented your suggestion and tested with the following. Please approve the PR or suggest further changes, thanks. Testing descriptioncfg: Runs: # pip install . && zppy -c ../zppy_cfgs/issue688_20250521/issue688_20250521_v2.cfg
# cd /global/cfs/cdirs/e3sm/forsyth/debug_issue688_20250521_try10/post/scripts/ && grep -v "OK" *status
# No errors when running ../zppy_cfgs/issue688_20250521/issue688_20250521_v2.cfg (try10)
filename="${topography_file##*/}"
echo "filename=${filename}"
if [[ $filename =~ ne[0-9]+np4pg2+ ]]; then
grid="${BASH_REMATCH[0]}"
echo "grid=${grid}"
if [[ -z "${res}" ]]; then
echo "Inferring res from grid"
if [[ $grid =~ ne([0-9]*) ]]; then
res=${BASH_REMATCH[1]}
fi
fi
pg2=true
else
echo "Pattern not found in filename: $filename"
fi
echo "res=${res}" # 120
echo "pg2=${pg2}" # true# pip install . && zppy -c ../zppy_cfgs/issue688_20250521/issue688_20250521_v2.cfg
# cd /global/cfs/cdirs/e3sm/forsyth/debug_issue688_20250521_try9/post/scripts/ && grep -v "OK" *status
# No errors when running ../zppy_cfgs/issue688_20250521/issue688_20250521_v2.cfg (try9)
if [[ ${topography_file##*/} =~ [^_]*_([^_]*)_.*nc ]]; then
grid=${BASH_REMATCH[1]}
echo "grid=${grid}"
if [[ -z "${res}" ]]; then
echo "Inferring res from grid"
if [[ $grid =~ ne([0-9]*) ]]; then
res=${BASH_REMATCH[1]}
fi
fi
if [[ $grid =~ pg2 ]]; then
pg2=true
fi
fi
echo "res=${res}" # 120
echo "pg2=${pg2}" # true# pip install . && zppy -c ../zppy_cfgs/issue688_20250521/issue688_20250521_v2.cfg
# cd /global/cfs/cdirs/e3sm/forsyth/debug_issue688_20250521_try8/post/scripts/ && grep -v "OK" *status
# Causes `Error: Insufficient values for option --res` when running ../zppy_cfgs/issue688_20250521/issue688_20250521_v2.cfg (try8)
if [[ $topography_file =~ /[^_]*_([^_]*)_.*nc ]]; then
grid=${BASH_REMATCH[1]}
echo "grid=${grid}"
if [[ -z "${res}" ]]; then
echo "Inferring res from grid"
if [[ $grid =~ ne([0-9]*) ]]; then
res=${BASH_REMATCH[1]}
fi
fi
if [[ $grid =~ pg2 ]]; then
pg2=true
fi
fi
echo "res=${res}" # empty
echo "pg2=${pg2}" # false |
||
| grid="${BASH_REMATCH[0]}" | ||
| echo "grid=${grid}" | ||
| if [[ -z "${res}" ]]; then | ||
| echo "Inferring res from grid" | ||
| if [[ $grid =~ ne([0-9]*) ]]; then | ||
| res=${BASH_REMATCH[1]} | ||
| fi | ||
| fi | ||
| if [[ $grid =~ pg2 ]]; then | ||
| pg2=true | ||
| fi | ||
| pg2=true | ||
| else | ||
| echo "Pattern not found in filename: $filename" | ||
| fi | ||
| echo "res=${res}" | ||
| echo "pg2=${pg2}" | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Question 1) So should I add a
pg2parameter or is it fine to leave it auto-determined?