Skip to content

Commit f970bcd

Browse files
CopilotDavidHuber-NOAAaerorahul
authored
Replace cp with cpfs/cpreq for atomic copies to COM directories (#4130)
This addresses issue #3051 by replacing standard `cp` commands with atomic copy utilities (`cpfs` and `cpreq` from `prod_util`) for all copies to COM directories. This is required per NCO Implementation Standards v11 to prevent downstream programs from accessing incomplete files. Fixes #3051 Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: DavidHuber-NOAA <[email protected]> Co-authored-by: Rahul Mahajan <[email protected]> Co-authored-by: David Huber <[email protected]>
1 parent 1de5262 commit f970bcd

File tree

9 files changed

+263
-263
lines changed

9 files changed

+263
-263
lines changed

ush/getges.sh

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# sfcges, sfcgm3, sfcgm2, sfcgm1, sfcgp1, sfcgp2, sfcgp3,
2121
# biascr, satang, satcnt, gesfil
2222
# pgbges, pgiges, pgbgm6, pgigm6, pgbgm3, pgigm3, pgbgp3, pgigp3,
23-
# sigcur, sfccur, pgbcur, pgicur, prepqc, tcvg12, tcvges, tcvitl,
23+
# sigcur, sfccur, pgbcur, pgicur, prepqc, tcvg12, tcvges, tcvitl,
2424
# enggrb, enggri, icegrb, icegri, snogrb, snogrb_high, snogri, sstgrb, sstgri.
2525
# natges, natgm3, natgm2, natgm1, natgp1, natgp2, natgp3, natcur,
2626
# nsfges, nsfgm3, nsfgm2, nsfgm1, nsfgp1, nsfgp2, nsfgp3, nsfcur,
@@ -37,7 +37,7 @@
3737
# The script uses the utility command NHOUR.
3838
#
3939
# Example 1. Copy the production sigma guess for 1998100100 to the file sges.
40-
# getges.sh -e prod -t sigges -v 1998100100 sges
40+
# getges.sh -e prod -t sigges -v 1998100100 sges
4141
#
4242
# Example 2. Assign the pressure grib guess for the date 1998100121.
4343
# export XLFUNIT_12="$(getges.sh -qt pgbges||echo /dev/null)"
@@ -148,7 +148,7 @@ if [[ $gfile = '?' || $# -gt 1 || $err -ne 0 || -z $valid ||\
148148
echo " gfile is the guess file to write" >&2
149149
echo " (default is to write the guess file name to stdout)" >&2
150150
else
151-
echo " (Note: set a given option to '?' for more details)" >&2
151+
echo " (Note: set a given option to '?' for more details)" >&2
152152
fi
153153
exit 1
154154
fi
@@ -158,7 +158,7 @@ if [[ $envir != prod && $envir != test && $envir != para && $envir != dump && $e
158158
envir=prod
159159
echo '************************************************************' >&2
160160
echo '* WARNING: Using "-e" is deprecated in this case. *' >&2
161-
echo '* Please use "-n" instead. *' >&2
161+
echo '* Please use "-n" instead. *' >&2
162162
echo '************************************************************' >&2
163163
fi
164164
if [[ "$netwk" = "namopl" || "$resol" = "namopl" ]];then
@@ -188,13 +188,13 @@ if [[ $typef = enggrb ]];then
188188
typef=icegrb
189189
echo '************************************************************' >&2
190190
echo '* WARNING: Using "-t enggrb" is now deprecated. *' >&2
191-
echo '* Please use "-t icegrb". *' >&2
191+
echo '* Please use "-t icegrb". *' >&2
192192
echo '************************************************************' >&2
193193
elif [[ $typef = enggri ]];then
194194
typef=icegri
195195
echo '************************************************************' >&2
196196
echo '* WARNING: Using "-t enggri" is now deprecated. *' >&2
197-
echo '* Please use "-t icegri". *' >&2
197+
echo '* Please use "-t icegri". *' >&2
198198
echo '************************************************************' >&2
199199
fi
200200

@@ -224,26 +224,26 @@ if [[ "$netwk" = "gdas" ]];then
224224
$COMINgdas/gdas.t${cyc}z.radstat'
225225
;;
226226
pgbges) geslist='
227-
$COMINgdas/gdas.t${cyc}z.pgrbh$fh
227+
$COMINgdas/gdas.t${cyc}z.pgrbh$fh
228228
$COMINgdas/gdas.t${cyc}z.pgrbf$fh'
229229
;;
230230
pg2ges) geslist='
231231
$COMINgdas/gdas.t${cyc}z.pgrb2.0p25.f$gh'
232232
;;
233233
pgbgm6) geslist='
234-
$COMINgdas/gdas.t${cyc}z.pgrbh$fhm6
234+
$COMINgdas/gdas.t${cyc}z.pgrbh$fhm6
235235
$COMINgdas/gdas.t${cyc}z.pgrbf$fhm6'
236236
;;
237237
pgbgm3) geslist='
238-
$COMINgdas/gdas.t${cyc}z.pgrbh$fhm3
238+
$COMINgdas/gdas.t${cyc}z.pgrbh$fhm3
239239
$COMINgdas/gdas.t${cyc}z.pgrbf$fhm3'
240240
;;
241241
pgbgp3) geslist='
242-
$COMINgdas/gdas.t${cyc}z.pgrbh$fhp3
242+
$COMINgdas/gdas.t${cyc}z.pgrbh$fhp3
243243
$COMINgdas/gdas.t${cyc}z.pgrbf$fhp3'
244244
;;
245245
pgbcur) geslist='
246-
$COMINgdas/gdas.t${cyc}z.pgrbh$fh
246+
$COMINgdas/gdas.t${cyc}z.pgrbh$fh
247247
$COMINgdas/gdas.t${cyc}z.pgrbf$fh'
248248
fhbeg=00
249249
;;
@@ -446,35 +446,35 @@ elif [[ "$netwk" = "cfs-cdas" ]];then
446446
$COMINcfs_cdas/cdas1.t${cyc}z.sfluxgrbf$fhp3'
447447
;;
448448
pgbges) geslist='
449-
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbh$fh
449+
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbh$fh
450450
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbf$fh'
451451
;;
452452
pgiges) geslist='
453-
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbih$fh
453+
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbih$fh
454454
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbif$fh'
455455
;;
456456
pgbgm6) geslist='
457-
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbh$fhm6
457+
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbh$fhm6
458458
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbf$fhm6'
459459
;;
460460
pgigm6) geslist='
461-
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbih$fhm6
461+
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbih$fhm6
462462
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbif$fhm6'
463463
;;
464464
pgbgm3) geslist='
465-
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbh$fhm3
465+
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbh$fhm3
466466
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbf$fhm3'
467467
;;
468468
pgigm3) geslist='
469-
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbih$fhm3
469+
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbih$fhm3
470470
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbif$fhm3'
471471
;;
472472
pgbgp3) geslist='
473-
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbh$fhp3
473+
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbh$fhp3
474474
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbf$fhp3'
475475
;;
476476
pgigp3) geslist='
477-
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbih$fhp3
477+
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbih$fhp3
478478
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbif$fhp3'
479479
;;
480480
sigcur) geslist='
@@ -490,12 +490,12 @@ elif [[ "$netwk" = "cfs-cdas" ]];then
490490
fhbeg=00
491491
;;
492492
pgbcur) geslist='
493-
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbh$fh
493+
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbh$fh
494494
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbf$fh'
495495
fhbeg=00
496496
;;
497497
pgicur) geslist='
498-
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbih$fh
498+
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbih$fh
499499
$COMINcfs_cdas/cdas1.t${cyc}z.pgrbif$fh'
500500
fhbeg=00
501501
;;
@@ -1405,7 +1405,7 @@ if [[ -z "$gfile" ]];then
14051405
echo ${ges}
14061406
err=$?
14071407
else
1408-
cp ${ges} ${gfile}
1408+
cpfs ${ges} ${gfile}
14091409
err=$?
14101410
fi
14111411

ush/minmon_xtrct_costs.pl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#---------------------------------------------------------------------------
44
# minmon_xtrct_costs.pl
55
#
6-
# Extract cost data from gsistat file and load into cost
6+
# Extract cost data from gsistat file and load into cost
77
# and cost term files.
88
#---------------------------------------------------------------------------
99

@@ -63,7 +63,7 @@
6363
my $jl_number = 8;
6464

6565
my $costfile = $ENV{"mm_costfile"};
66-
66+
6767
if( (-e $costfile) ) {
6868
open( COSTFILE, "<${costfile}" ) or die "Can't open ${costfile}: $!\n";
6969
my $line;
@@ -87,7 +87,7 @@
8787

8888
#------------------------------------------------------------------------
8989
# Open the infile and search for the $costterms_target and $cost_target
90-
# strings. If found, parse out the cost information and push into
90+
# strings. If found, parse out the cost information and push into
9191
# holding arrays.
9292
#------------------------------------------------------------------------
9393
if( $rc == 0 ) {
@@ -107,14 +107,14 @@
107107
$use_costterms = 1;
108108
}
109109

110-
if( $line =~ /$cost_target/ ) {
110+
if( $line =~ /$cost_target/ ) {
111111
my @costline = split( / +/, $line );
112112
push( @cost_array, $costline[$cost_number] );
113113
}
114114

115115
if( $term_ctr > 0 ) {
116116
my @termline = split( / +/, $line );
117-
117+
118118
if ( $term_ctr < 10 ) {
119119
push( @term_array, trim($termline[1]) );
120120
push( @term_array, trim($termline[2]) );
@@ -132,7 +132,7 @@
132132
push( @term_array, trim($termline[3]) );
133133
push( @term_array, trim($termline[4]) );
134134
$term_ctr = 1;
135-
}
135+
}
136136
}
137137

138138
close( INFILE );
@@ -145,13 +145,13 @@
145145
for my $i (0 .. $#cost_array) {
146146
my $iterline;
147147
if( $use_costterms == 1 ){
148-
$iterline = sprintf ' %d,%e,%e,%e,%e,%e%s',
149-
$i, $cost_array[$i], $jb_array[$i], $jo_array[$i],
148+
$iterline = sprintf ' %d,%e,%e,%e,%e,%e%s',
149+
$i, $cost_array[$i], $jb_array[$i], $jo_array[$i],
150150
$jc_array[$i], $jl_array[$i], "\n";
151151
}
152152
else {
153-
$iterline = sprintf ' %d,%e,%e,%e,%e,%e%s',
154-
$i, $cost_array[$i], $no_data, $no_data,
153+
$iterline = sprintf ' %d,%e,%e,%e,%e,%e%s',
154+
$i, $cost_array[$i], $no_data, $no_data,
155155
$no_data, $no_data, "\n";
156156
}
157157

@@ -161,7 +161,7 @@
161161
#---------------------------------------------------
162162
# move term_array into all_cost_terms by iteration
163163
#---------------------------------------------------
164-
if( @term_array > 0 ) {
164+
if( @term_array > 0 ) {
165165
my $nterms = 32;
166166
my $max_iter = ($#term_array+1)/$nterms;
167167
my $niter = $max_iter -1;
@@ -170,18 +170,18 @@
170170
my $step = $iter * $nterms;
171171
my $iterline = sprintf '%d, %e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e,%e%s',
172172
$iter, $term_array[$step], $term_array[$step+1], $term_array[$step+2],
173-
$term_array[$step+3], $term_array[$step+4], $term_array[$step+5],
174-
$term_array[$step+6], $term_array[$step+7], $term_array[$step+8],
175-
$term_array[$step+9], $term_array[$step+10], $term_array[$step+11],
176-
$term_array[$step+12], $term_array[$step+13], $term_array[$step+14],
177-
$term_array[$step+15], $term_array[$step+16], $term_array[$step+17],
178-
$term_array[$step+18], $term_array[$step+19], $term_array[$step+20],
179-
$term_array[$step+21], $term_array[$step+22], $term_array[$step+23],
180-
$term_array[$step+24], $term_array[$step+25], $term_array[$step+26],
181-
$term_array[$step+27], $term_array[$step+28], $term_array[$step+29],
173+
$term_array[$step+3], $term_array[$step+4], $term_array[$step+5],
174+
$term_array[$step+6], $term_array[$step+7], $term_array[$step+8],
175+
$term_array[$step+9], $term_array[$step+10], $term_array[$step+11],
176+
$term_array[$step+12], $term_array[$step+13], $term_array[$step+14],
177+
$term_array[$step+15], $term_array[$step+16], $term_array[$step+17],
178+
$term_array[$step+18], $term_array[$step+19], $term_array[$step+20],
179+
$term_array[$step+21], $term_array[$step+22], $term_array[$step+23],
180+
$term_array[$step+24], $term_array[$step+25], $term_array[$step+26],
181+
$term_array[$step+27], $term_array[$step+28], $term_array[$step+29],
182182
$term_array[$step+30], $term_array[$step+31], "\n";
183183
push( @all_cost_terms, $iterline );
184-
}
184+
}
185185
}
186186

187187
#------------------------------------------
@@ -210,15 +210,15 @@
210210
my $tankdir = $ENV{"M_TANKverf"};
211211
if(! -d $tankdir) {
212212
system( "mkdir -p $tankdir" );
213-
}
213+
}
214214

215215
if( -e $filename2 ) {
216216
my $newfile2 = "${tankdir}/${filename2}";
217-
system("cp -f $filename2 $newfile2");
217+
system("cpfs $filename2 $newfile2");
218218
}
219219
if( -e $filename3 ) {
220220
my $newfile3 = "${tankdir}/${filename3}";
221-
system("cp -f $filename3 $newfile3");
221+
system("cpfs $filename3 $newfile3");
222222
}
223223

224224
} # $rc still == 0 after reading gmon_cost.txt

0 commit comments

Comments
 (0)