Skip to content

Commit 4861c7a

Browse files
Chris BlantonChris Blanton
authored andcommitted
Adjustments related to cleaning tasks and end-case where history segment=pp chunk
- Convert history segment and pp chunk comparisons to string before comparing - Adjust the cleaning task boundaries to target beginning-of-chunk instead of end-of-chunk - In cleaning tasks remove unnecessary check for directory existance
1 parent d4a2d3d commit 4861c7a

File tree

2 files changed

+14
-26
lines changed

2 files changed

+14
-26
lines changed

Jinja2Filters/form_remap_dep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def form_remap_dep(grid_type: str,
5656
# Note: history_segment should be specified for primary chunk generation,
5757
# and omitted for secondary chunk generation.
5858
if output_type == "ts":
59-
if history_segment == chunk:
59+
if str(history_segment) == str(chunk):
6060
prereq_task = "rename-split-to-pp"
6161
else:
6262
prereq_task = "make-timeseries"

flow.cylc

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ rename-split-to-pp-regrid<regrid_static> => remap-pp-components-static => combin
282282
{% for SEGMENT in chunk.segments[1:] %}
283283
& rename-split-to-pp-regrid<regrid>[{{ SEGMENT }}]
284284
{% endfor %}
285-
{% if HISTORY_SEGMENT != chunk.chunk_size %}
285+
{% if HISTORY_SEGMENT != chunk.chunk_size | string %}
286286
=> make-timeseries-regrid-{{ chunk.chunk_size }}<regrid>
287287
{% endif %}
288288
{% if DO_TIMEAVGS and not chunk.is_partial %}
@@ -295,7 +295,7 @@ rename-split-to-pp-regrid<regrid_static> => remap-pp-components-static => combin
295295
{% for SEGMENT in chunk.segments[1:] %}
296296
& rename-split-to-pp-native<native>[{{ SEGMENT }}]
297297
{% endfor %}
298-
{% if HISTORY_SEGMENT != chunk.chunk_size %}
298+
{% if HISTORY_SEGMENT != chunk.chunk_size | string %}
299299
=> make-timeseries-native-{{ chunk.chunk_size }}<native>
300300
{% endif %}
301301
{% if DO_TIMEAVGS and not chunk.is_partial %}
@@ -1027,9 +1027,7 @@ rename-split-to-pp-regrid<regrid_static> => remap-pp-components-static => combin
10271027
inherit = CLEAN
10281028
script = """
10291029
rm -rf $CYLC_WORKFLOW_SHARE_DIR/shards/ts/native/*/P0Y
1030-
{% if DO_REGRID %}
10311030
rm -rf $CYLC_WORKFLOW_SHARE_DIR/shards/ts/regrid-xy/*/*/P0Y
1032-
{% endif %}
10331031
"""
10341032
{% endif %}
10351033

@@ -1038,9 +1036,7 @@ rename-split-to-pp-regrid<regrid_static> => remap-pp-components-static => combin
10381036
script = """
10391037
dirs="$CYLC_WORKFLOW_SHARE_DIR/shards/ts/native/*/*/{{ HISTORY_SEGMENT }} $CYLC_WORKFLOW_SHARE_DIR/shards/ts/regrid-xy/*/*/*/{{ HISTORY_SEGMENT }}"
10401038
for dir in $dirs; do
1041-
if ls $dir; then
1042-
find $dir -type f -name "*.*-$(cylc cycle-point --template CCYY)*.nc" -print -delete
1043-
fi
1039+
find $dir -type f -name "*.$(cylc cycle-point --template CCYY)*-*.nc" -print -delete
10441040
done
10451041
"""
10461042

@@ -1049,12 +1045,10 @@ rename-split-to-pp-regrid<regrid_static> => remap-pp-components-static => combin
10491045
script = """
10501046
dirs="$CYLC_WORKFLOW_SHARE_DIR/shards/*/native/*/*/{{ PP_CHUNK_A }} $CYLC_WORKFLOW_SHARE_DIR/shards/*/regrid-xy/*/*/*/{{ PP_CHUNK_A }}"
10511047
for dir in $dirs; do
1052-
if ls $dir; then
1053-
if [[ {{ PP_CHUNK_A }} == P1Y ]]; then
1054-
find $dir -type f -name "*.$(cylc cycle-point --template CCYY)*.nc" -print -delete
1055-
else
1056-
find $dir -type f -name "*.*-$(cylc cycle-point --template CCYY)*.nc" -print -delete
1057-
fi
1048+
if [[ {{ PP_CHUNK_A }} == P1Y ]]; then
1049+
find $dir -type f -name "*.$(cylc cycle-point --template CCYY)*.nc" -print -delete
1050+
else
1051+
find $dir -type f -name "*.$(cylc cycle-point --template CCYY)*-*.nc" -print -delete
10581052
fi
10591053
done
10601054
"""
@@ -1065,9 +1059,7 @@ rename-split-to-pp-regrid<regrid_static> => remap-pp-components-static => combin
10651059
script = """
10661060
dirs="$CYLC_WORKFLOW_SHARE_DIR/shards/*/native/*/*/{{ PP_CHUNK_B }} $CYLC_WORKFLOW_SHARE_DIR/shards/*/regrid-xy/*/*/*/{{ PP_CHUNK_B }}"
10671061
for dir in $dirs; do
1068-
if ls $dir; then
1069-
find $dir -type f -name "*.*-$(cylc cycle-point --template CCYY)*.nc" -print -delete
1070-
fi
1062+
find $dir -type f -name "*.$(cylc cycle-point --template CCYY)*-*.nc" -print -delete
10711063
done
10721064
"""
10731065
{% endif %}
@@ -1077,12 +1069,10 @@ rename-split-to-pp-regrid<regrid_static> => remap-pp-components-static => combin
10771069
script = """
10781070
dirs=$CYLC_WORKFLOW_SHARE_DIR/pp/av/*/*/{{ PP_CHUNK_A }}
10791071
for dir in $dirs; do
1080-
if ls $dir; then
1081-
if [[ {{ PP_CHUNK_A }} == P1Y ]]; then
1082-
find $dir -type f -name "*.$(cylc cycle-point --template CCYY)*.nc" -print -delete
1083-
else
1084-
find $dir -type f -name "*.*-$(cylc cycle-point --template CCYY)*.nc" -print -delete
1085-
fi
1072+
if [[ {{ PP_CHUNK_A }} == P1Y ]]; then
1073+
find $dir -type f -name "*.$(cylc cycle-point --template CCYY)*.nc" -print -delete
1074+
else
1075+
find $dir -type f -name "*.$(cylc cycle-point --template CCYY)*-*.nc" -print -delete
10861076
fi
10871077
done
10881078
"""
@@ -1093,9 +1083,7 @@ rename-split-to-pp-regrid<regrid_static> => remap-pp-components-static => combin
10931083
script = """
10941084
dirs=$CYLC_WORKFLOW_SHARE_DIR/pp/av/*/*/{{ PP_CHUNK_B }}
10951085
for dir in $dirs; do
1096-
if ls $dir; then
1097-
find $dir -type f -name "*.*-$(cylc cycle-point --template CCYY)*.nc" -print -delete
1098-
fi
1086+
find $dir -type f -name "*.$(cylc cycle-point --template CCYY)*-*.nc" -print -delete
10991087
done
11001088
"""
11011089
{% endif %}

0 commit comments

Comments
 (0)