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

add fstats customized for screen-level Q and T with "land only" option #246

Merged
merged 13 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions GEOS_Util/post/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,23 @@ ecbuild_add_executable (TARGET rs_vinterp.x SOURCES rs_vinterp.F90)
ecbuild_add_executable (TARGET rs_vinterp_scm.x SOURCES rs_vinterp_scm.F90)

ecbuild_add_executable (TARGET stats.x SOURCES stats.F90)
ecbuild_add_executable (TARGET statsNx.x SOURCES statsNx.F90)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you also need to remove "statsNx" here and below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CMakelists is just updated . we still keep statsNx.rc .

if (DISABLE_FIELD_WIDTH_WARNING)
set_target_properties (stats.x PROPERTIES COMPILE_FLAGS ${DISABLE_FIELD_WIDTH_WARNING})
set_target_properties (statsNx.x PROPERTIES COMPILE_FLAGS ${DISABLE_FIELD_WIDTH_WARNING})
endif ()
set_target_properties (stats.x PROPERTIES COMPILE_FLAGS "${BIG_ENDIAN}")
set_target_properties (statsNx.x PROPERTIES COMPILE_FLAGS "${BIG_ENDIAN}")
set_target_properties(stats.x PROPERTIES Fortran_MODULE_DIRECTORY ${include_${this}})
set_target_properties(statsNx.x PROPERTIES Fortran_MODULE_DIRECTORY ${include_${this}})

ecbuild_add_executable (TARGET convert_aerosols.x SOURCES convert_aerosols.F)
ecbuild_add_executable (TARGET 3CH_mpi.x SOURCES 3CH.F90)

set (perlscripts
ecmwf2geos.pl
g5fcst_stats.pl
g5fcst_statsNx.pl
ncep2geos.pl
regrid.pl
)
Expand All @@ -53,7 +58,6 @@ set_property(SOURCE rsg3_vinterp.F APPEND_STRING PROPERTY COMPILE_FLAGS "${FREAL
set_property(SOURCE rs_vinterp.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FREAL8} ${BYTERECLEN}")
set_property(SOURCE rs_vinterp_scm.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${FREAL8} ${BYTERECLEN}")
set_property(SOURCE 3CH.F90 APPEND_STRING PROPERTY COMPILE_FLAGS "${BYTERECLEN} ${EXTENDED_SOURCE}")

set_property(SOURCE dynamics_lattice_module.F APPEND_STRING PROPERTY COMPILE_FLAGS "${BYTERECLEN} ${EXTENDED_SOURCE}")
set_property(SOURCE mpi_util.F APPEND_STRING PROPERTY COMPILE_FLAGS "${BYTERECLEN} ${EXTENDED_SOURCE}")
set_property(SOURCE mymalloc.F APPEND_STRING PROPERTY COMPILE_FLAGS "${BYTERECLEN} ${EXTENDED_SOURCE}")
Expand Down Expand Up @@ -87,6 +91,7 @@ target_link_libraries (ec_prs2eta.x ${this} GMAO_gfio_r4 MAPL)
target_link_libraries (era5_prs2eta.x ${this} GMAO_gfio_r4 MAPL)
target_link_libraries (ec_prs2fv.x ${this} GMAO_gfio_r4 MAPL)
target_link_libraries (stats.x post_nompi GMAO_gfio_r4 MAPL ${ESMF_LIBRARIES})
target_link_libraries (statsNx.x post_nompi GMAO_gfio_r4 MAPL ${ESMF_LIBRARIES})
target_link_libraries (flat2hdf.x post_nompi GMAO_gfio_r4)
target_link_libraries (gg2fv.x post)
target_link_libraries (rs2hdf.x post)
Expand Down Expand Up @@ -143,6 +148,7 @@ set (post_rc
plot.rc
post.rc
stats.rc
statsNx.rc
time_ave.rc
3CH.rc
)
Expand All @@ -153,7 +159,7 @@ install (
)

install (
FILES stats.rc time_ave.rc
FILES stats.rc time_ave.rc statsNx.rc
DESTINATION etc
)

Expand Down
107 changes: 92 additions & 15 deletions GEOS_Util/post/g5fcst_stats.pl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
#=======================================================================
# name - g5fcst_stats.pl
# purpose - script to submit jobs to calculate forecast statistics
# name - g5fcst_stats.pl
# purpose - script to submit jobs to calculate screen level forecast statistics
Copy link
Contributor

Choose a reason for hiding this comment

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

The edit in this comment doesn't seem to be correct. Isn't this the merged script that does the regular atm stats and now also screen-level?

#
# key global variables -
# => $storedir: directory where output files get copied
Expand Down Expand Up @@ -29,7 +29,11 @@
my ($offset_sec, $pesto, $progdir, $progtype, $secs_per_day, $secs_per_hour);
my ($statsX, $storedir, $tau_freq, $tau_fsec, $vanadir, $vanatype, $vexpid);
my (%opts, @acqIDs, @statsIDs);
my ($landonly, $landonly_dflt);
my ($nxonly, $nxonly_dflt);

$landonly_dflt = "no";
$nxonly_dflt = "no" ;
$fhours_dflt = 123;
$localID = $$;
$ncsuffix = ".nc4";
Expand Down Expand Up @@ -135,7 +139,11 @@

if ($ihh eq "00" and $nv == 1) {
$fdir = "$vanadir/Y$nyyyy/M$nmm";
$fname = "$vexpid.$vanatype.inst3d_met_p.${vdate}_${vhh}${vmn}z";
if ($nxonly eq "yes") {
$fname = "$vexpid.$vanatype.${vdate}_${vhh}${vmn}z";
} else {
$fname = "$vexpid.$vanatype.inst3d_met_p.${vdate}_${vhh}${vmn}z";
}
$ffile0 = "$fdir/$fname$ncsuffix";
}
else {
Expand Down Expand Up @@ -167,7 +175,11 @@
push @alist, "$vexpid.$vanatype.${vdate}_${vhh}z+${vdate}_${vhh}${vmn}z";
}
else {
push @alist, "$vexpid.$vanatype.inst3d_met_p.${vdate}_${vhh}${vmn}z";
if ($nxonly eq "yes" ) {
push @alist, "$vexpid.$vanatype.${vdate}_${vhh}${vmn}z";
} else {
push @alist, "$vexpid.$vanatype.inst3d_met_p.${vdate}_${vhh}${vmn}z";
}
}

# loop through naming convention options
Expand All @@ -192,9 +204,12 @@
#----------------------------------------------------
($vdate, $vtime) = tick($vdate, $vtime, $tau_fsec);
}

if ($nxonly eq "yes") {
@climfiles = (<$ENV{SHARE}/dao_ops/verification/stats/MERRA-2.inst1_2d_asm_Nx.198501_201412.clim_??z.576x361.data.nc4>);
} else {
@climfiles = (<$ENV{SHARE}/dao_ops/verification/stats/MERRA-2.inst3_3d_asm_Np.198501_201412.clim_??z.576x361.data.nc4>);
#--@climfiles = (<$ENV{SHARE}/dao_ops/verification/stats/merrasc.197901-200812.clim_??z.144x91.data.nc>);
}
$climfilecnt = scalar(@climfiles);
if ($climfilecnt < 4) {
rmtree($fstatswork) if -d $fstatswork;
Expand All @@ -221,15 +236,23 @@
}
else {
push @fcst_fnames, $ffile0 if $ffile0;
push @fcst_fnames, "$expid.prog.$progtype.${ndate}_${ihh}z+*$ncsuffix";
push @ana_fnames, "$vexpid.asm.inst3d_met_p.*$ncsuffix";
push @fcst_fnames, "$expid.prog.$progtype.${ndate}_${ihh}z+*$ncsuffix";
if ($nxonly eq "yes" ) {
push @ana_fnames, "$vexpid.$vanatype.*$ncsuffix";
} else {
push @ana_fnames, "$vexpid.asm.inst3d_met_p.*$ncsuffix";
}
}
}
else {
push @fcst_fnames, $ffile0 if $ffile0;
push @fcst_fnames, "$expid.prog.$progtype.${ndate}_${ihh}z+*$ncsuffix";
push @ana_fnames, "$vexpid.asm.inst3d_met_p.*$ncsuffix";
push @ana_fnames, "$vexpid.ana.inst3d_met_p.*$ncsuffix";
if ($nxonly eq "yes" ) {
push @ana_fnames, "$vexpid.$vanatype.*$ncsuffix"
} else {
push @ana_fnames, "$vexpid.asm.inst3d_met_p.*$ncsuffix";
push @ana_fnames, "$vexpid.ana.inst3d_met_p.*$ncsuffix";
}
}
@fcstlist = sort keys %fcsthash;
@vanalist = sort keys %vanahash;
Expand Down Expand Up @@ -282,6 +305,8 @@
$args{"vhh0"} = $vhh0;
$args{"vhh1"} = $vhh1;
$args{"nodes"} = $nodes;
$args{"landonly"} = $landonly;
$args{"nxonly"} = $nxonly;

# submit job to calculate stats
#------------------------------
Expand Down Expand Up @@ -344,6 +369,10 @@ sub init {

"nodes=s" => \$nodes,

"landonly=s" => \$landonly,

"nxonly=s" => \$nxonly,

"das" => \$dasFLG,
"np" => \$noprompt,

Expand All @@ -359,7 +388,15 @@ sub init {
$expid = shift @ARGV;
$idate = shift @ARGV;
$ndays = shift @ARGV;


# landonly option
#----------------
$landonly = $landonly_dflt unless $landonly;

#nxonly option
#--------------
$nxonly = $nxonly_dflt unless $nxonly;

# initial fcst hour and offset
#-----------------------------
unless ($ihh) {
Expand Down Expand Up @@ -536,7 +573,11 @@ sub init {
# find stats.rc
#--------------
$fv_etcdir = dirname($Bin) ."/etc";
die "Error. Cannot find $fv_etcdir/stats.rc" unless -e "$fv_etcdir/stats.rc";
if ($nxonly eq "yes" ) {
die "Error. Cannot find $fv_etcdir/statsNx.rc" unless -e "$fv_etcdir/statsNx.rc";
} else {
die "Error. Cannot find $fv_etcdir/stats.rc" unless -e "$fv_etcdir/stats.rc";
}
}

#=======================================================================
Expand Down Expand Up @@ -636,11 +677,14 @@ sub submit_calcjob {
my (@rmfilelist, $yyyy, $mm, $dd);
my ($logdir, $logfile1, $logfile2, $jobname, $jobdate, $jobfile, $jobtype);
my ($cmd, $jobID, $jobIDline);
my (@levs, @levels_19, @levels_11);
my (@levs, @levels_19, @levels_11, @levels_1);
my ($mynodes,$usrnodes);
my ($qos, $partition);
my ($ntspn, $npn);

my ($landonly, $landmaskdirfile);
my ($nxonly);
my ($whichrc);

@levels_19 = ( 1000.0, 975.0, 950.0, 925.0,
900.0, 850.0, 800.0, 750.0,
700.0, 600.0, 500.0, 400.0,
Expand All @@ -651,6 +695,8 @@ sub submit_calcjob {
500.0, 400.0, 300.0, 250.0,
200.0, 150.0, 100.0 );

@levels_1 = ( 1000.0 ) ;

if ($vexpid eq "ecmwf") { @levs = @levels_11 }
else { @levs = @levels_19 }

Expand All @@ -668,6 +714,18 @@ sub submit_calcjob {
$vdate1 = $args{"vdate1"};
$vhh1 = $args{"vhh1"};
$usrnodes = $args{"nodes"};
$landonly = $args{"landonly"};
$nxonly = $args{"nxonly"};
if ($landonly eq "yes") { $landmaskdirfile = "$jobdir/landmaskfile.nc4"}
print "nxonly: $nxonly\n";
print "landonly: $landonly\n";

$whichrc = "stats.rc";
if ($nxonly eq "yes") {
@levs = @levels_1;
$whichrc = "statsNx.rc";
print "whichrc: $whichrc\n";
}

foreach (@fcstlist, @vanalist) { push @rmfilelist, basename($_) };

Expand Down Expand Up @@ -736,12 +794,24 @@ sub submit_calcjob {
-cli @climfiles \\
-tag $expid.${ihh}z \\
-nfreq ${tau_freq}0000 \\
EOF
if ( $landonly eq "yes" ) {
print FH <<"EOF";
-land ${landmaskdirfile} \\
EOF
}

print FH <<"EOF";
-levs @levs \\
-o $expid.fstats.log.$jobdate.txt \\
-verif gmao \\
-fcsrc gmao \\
-fhour $fhours \\
-rc $fv_etcdir/stats.rc
-rc $fv_etcdir/$whichrc
EOF

print FH <<"EOF";

@ calc_status = \$status

$pesto -arc $arcfile \\
Expand Down Expand Up @@ -940,7 +1010,8 @@ sub verify_values {
print "progdir: $progdir\n";
print "progtype: $progtype\n";
print "fs_tag: $fs_tag\n\n";

print "landonly: $landonly\n\n";
print "nxonly: $nxonly\n\n";
print "dryrun: $dryrun\n\n" if $dryrun;

$ans = query("Continue (y/n):", "y");
Expand Down Expand Up @@ -986,6 +1057,12 @@ sub usage {
[dirname(\$FVHOME) or \$NOBACKUP]
-noarchive do not archive outputs [archives by default]

-landonly calculate stats only over land surface (yes/no)
[no by default]

-nxonly calculate stats of 2d Nx collection only (yes/no)
[no by default]

-nodes nodesname specify nodes (e.g., sky, hasw, or cas)
-das check for DAS hidden files before attempting to fetch files
and set no prompt; requires \$FVHOME environment variable;
Expand Down
Loading