Skip to content

Commit

Permalink
NAWIPS 7.18.0 Code Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
akrherz committed May 24, 2024
1 parent 29b969c commit 53233b1
Show file tree
Hide file tree
Showing 7 changed files with 492 additions and 6 deletions.
3 changes: 2 additions & 1 deletion gempak/source/gemlib/ss/ssvers.f
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ SUBROUTINE SS_VERS ( vmsg, iret )
C* B. Hebbard/NCEP 02/23 Updated to 7.16.0 *
C* B. Hebbard/NCEP 05/23 Updated to 7.16.1 *
C* B. Hebbard/NCEP 07/23 Updated to 7.17.0 *
C* B. Hebbard/NCEP 01/24 Updated to 7.18.0 *
C************************************************************************
CHARACTER*(*) vmsg
C------------------------------------------------------------------------
iret = 0
C
C* Set the version string and add a null to the end.
C
vmsg = 'Version 7.17.0'
vmsg = 'Version 7.18.0'
CALL ST_NULL ( vmsg, vmsg, lens, ier )
C*
RETURN
Expand Down
7 changes: 5 additions & 2 deletions gempak/source/programs/dc/dcuair/dcudcd.f
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ SUBROUTINE DCUDCD ( curtim, gemfil, stntbl, iadstn, maxtim,
C* S. Chiswell/Unidata 5/01 Added stid to RU_SHDR, RU_DECD, RU_DUPE *
C* B. Yin/SAIC 3/04 Changed SS_GTIM to CSS_GTIM *
C* m.gamazaychikov/SAIC 07/05 Added code for dropsonde wind cutoff hgt*
C* S. Guan/NCEP 3/23 Decode both the 21212 group winds in *
C* S. Guan/NCEP 3/23 Decoded both the 21212 group winds in *
C* the TTBB message and the following PPBB *
C* winds. *
C* S. Guan/NCEP 4/24 Added duplicate PPBB winds check. *
C************************************************************************
INCLUDE 'GEMPRM.PRM'
INCLUDE 'BRIDGE.PRM'
Expand Down Expand Up @@ -243,7 +244,9 @@ SUBROUTINE DCUDCD ( curtim, gemfil, stntbl, iadstn, maxtim,
C
ipres = INDEX ( bultin ( 1: lenbul ), '21212' )
IF ( ipres .ne. 0 ) THEN
IF ( part .eq. 'PPBB' ) good = .true.
IF ( part .eq. 'PPBB' ) THEN
IF ( .not. zwind ) good = .true.
END IF
END IF
END IF
IF ( good ) THEN
Expand Down
8 changes: 6 additions & 2 deletions gempak/source/programs/gp/gptcww/gptcww.f
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ PROGRAM GPTCWW
C* the correct first tau, pass the inital *
C* tau to GC_TC2VG *
C* X. Guo/CWS 05/10 Added idays to GH_TCWW *
C* S. Jacobs/NCEP 6/10 Re-added flag for plotting the scale *
C* S. Jacobs/NCEP 6/10 Re-added flag for plotting the scale *
C* B. Hebbard/SDB 02/24 Changed 2-digit-year century break from *
C* 2025/2026 to 2040/2041 to match others *
C************************************************************************
INCLUDE 'GEMPRM.PRM'
C*
Expand Down Expand Up @@ -260,7 +262,9 @@ PROGRAM GPTCWW
CALL ST_LSTR( strnam, lenn, ier )
IF ( lenn .eq. 6 ) THEN
CALL ST_NUMB ( strnam(5:6), istrm, ier )
IF ( istrm .le. 25 ) THEN
C Two-digit-year century break is currently 2040/2041;
C will require pushback before then.
IF ( istrm .le. 40 ) THEN
chyy = '20'
ELSE
chyy = '19'
Expand Down
6 changes: 5 additions & 1 deletion gempak/source/programs/gp/gptpc/gptpc.f
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ PROGRAM GPTPC
C* m.gamazaychikov/SAIC 06/08 Added remnlo to GH_RDAD CS *
C* X. Guo/CWS 03/10 Used Post-Tropical instead of Extratrop *
C* and Remnant Low. Removed remnlo *
C* B. Hebbard/SDB 02/24 Changed 2-digit-year century break from *
C* 2025/2026 to 2040/2041 to match others *
C************************************************************************
INCLUDE 'GEMPRM.PRM'
C*
Expand Down Expand Up @@ -174,7 +176,9 @@ PROGRAM GPTPC
CALL ST_LSTR( strnam, lenn, ier )
IF ( lenn .eq. 6 ) THEN
CALL ST_NUMB ( strnam(5:6), istrm, ier )
IF ( istrm .le. 25 ) THEN
C Two-digit-year century break is currently 2040/2041;
C will require pushback before then.
IF ( istrm .le. 40 ) THEN
chyy = '20'
ELSE
chyy = '19'
Expand Down
178 changes: 178 additions & 0 deletions scripts/decoder/gairm_metwatch_processor.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
#!/usr/bin/perl -w
use strict;
use POSIX qw(strftime);
use feature qw(switch);
no if $] >= 5.018, warnings => qw( experimental::smartmatch );
use Env;
use File::Copy;
use File::Basename;
###########################################################################
#
# Usage: gairm_metwatch_processor.pl -i <infile> -bulletin <S|T|Z>
# [-ofmt <dest dir/output fmt string>] [-bufrpath <path>]
# [-bufrexpr <expr>]
#
# Purpose: Support G-Airmet Metwatch function at 3-hour resolution via
# AIRM dcairm decoded format. The software is LDM event driven
# by receipt of G-AIRMET BUFR. The latest G-AIRMET BUFR
# messages are then identified from a database of BUFR
# messages, then converted to XML, then to GEMPAK decoded
# AIRMET text (YYMMDD_HH.gairm) via program xml2gairm4nmap.pl.
# The airmet files must be referenced in the datatype.tbl
# with the appropriate path for NMAP2 to load via MISC/GAIRM.
# The AIRMET text files are built using one of 3 BUFR messages
# as input, in conjunction with an existing database of BUFR
# messages. The database is referenced to determine the update
# number counts.
#
# Inputs: G-AIRMET BUFR and ID of Bulletin Type via -bulletin,
# BUFR messages database specified in -bufrpath
#
# Outputs: Intermediary XML documents, AIRMET text directory and format specified by
# -ofmt switch.
# Dependency: Script xml2gairm4nmap.pl
#
# Defaults:
# ofmt = $HOME/gairm/latest/%Y%m%d_%H.gairm
# bufrpath /data/products/bufr/gairm
# bufrexpr set to '(\d{8})_(\d{4})_(S|T|Z).gairm'
#
# Author: Larry J. Hinson, AWC 03/2010
#
##############################################################################
my $usageStatement;
$usageStatement = "Usage: gairm_metwatch_processor.pl -i <infile> -bulletin <S|T|Z> [-o <outfile>] [-bufrpath <path>] [-bufrexpr <expr>]
Optional Switches:
-h list usage
-i <inpfile> Full path of input file. Use - for stdin
-bulletin <S|T|Z>
-ofmt <Dest Dir/output format str> [Default = /\$HOME/gairm/latest/%Y%m%d_%H.gairm]
-bufrpath <path> Path to bufr files... [Default = /data/products/bufr/gairm]
-bufrexpr [regular expression] [Default = /(\\d{8})_(\\d{4})_(S|T|Z).gairm/]\n";
my ($inputfile, $inputsw, $stdinsw, $bufrpath, $bufrpathsw,
$bufrexpr, $bufrexprsw, $ofmt, $outfilesw, $bulletin,
$bulletinsw, $statusflag);

if (($#ARGV+1) < 2) {
print $usageStatement;
exit 1;
}

$stdinsw = $bufrpathsw = $bufrexprsw = 0;
$bufrexpr = '^(\d{8})_(\d{4})_(S|T|Z).gairm$';
$bufrpath = "/data/products/bufr/gairm";
$ofmt = "$ENV{'HOME'}/gairm/latest/%Y%m%d_%H.gairm";
$statusflag = "NRML";

while ($#ARGV+1) {
given($ARGV[0]) {
when ("-i") {
if ($ARGV[1] ne "-") {
$inputfile = $ARGV[1];
} else {
$inputfile = "<&STDIN";
$stdinsw = 1;
}
$inputsw = "-1";
}
when ("-bufrpath") {
$bufrpath = $ARGV[1];
$bufrpathsw = 1;
}
when ("-bufrexpr") {
$bufrexpr = $ARGV[1];
$bufrexprsw = 1;
}
when ("-ofmt") {
$ofmt = $ARGV[1];
}
when ("-bulletin") {
$bulletin = $ARGV[1];
$bulletinsw = 1;
}
when ("-h") {
print $usageStatement;
exit 1;
}
}
shift(@ARGV);
}
if (! ($inputsw && $bulletinsw)) {
print $usageStatement;
exit 1;
}

my $origdir = $ENV{'PWD'};
if ($inputfile !~ /\// && ! $stdinsw) {
$inputfile = sprintf("%s/%s",$origdir,$inputfile);
}

my $tmpdir = "/var/tmp/gairm_metwatch_processor.pl.$$";
mkdir ($tmpdir, 0777);
chdir ($tmpdir);

my $buffer;
open (INFILE,"$inputfile") || die "Cannot open $inputfile";
open (OUTFILE,">temp.bufr") || die "Cannot open Redirected file temp.bufr";
binmode INFILE;
binmode OUTFILE;
while ( read (INFILE, $buffer, 65536) ) {
print OUTFILE $buffer;
}
close(INFILE);
close(OUTFILE);
# Now Process buffer message to XML...
print ">>>bulletin=$bulletin\n";
`airmet_bufrvgf -i temp.bufr -opxml "%Y%m%d_%H%M_${bulletin}_<cycle>_pre.xml"`;
# xml created....Derive input bufr YYYYMMDD_HHMM parameter
my $dir = $tmpdir;
opendir(DIR,$dir);
my @xmlfiles = grep(/\d{8}_\d{4}_(S|T|Z)_\d{2}Z_pre.xml/,readdir(DIR));
closedir(DIR);
$_ = $xmlfiles[0];

my($xml_yyyymmdd,$xml_hhmm) = (/(\d{8})_(\d{4})/);

$_=$xml_hhmm;

my ($hour) = /(\d{2})/;

# Now Calculate an Update Number, based off of 0245Z issuance
# Account for if BUFR has already been filed away...
# If 0245Z issuance, set update number to 1.

my $updatecount = 0;
if ( $xml_hhmm ne "0245" ) {
$dir = $bufrpath;
my @bufrfiles;
opendir(DIR,$dir);
@bufrfiles = reverse sort grep(/$bufrexpr/,readdir(DIR));;
closedir(DIR);
my $file;
foreach $file (@bufrfiles) {
$_=$file;
my ($yyyymmdd,$hhmm,$btype) = /$bufrexpr/;
if (($btype =~ /S|SIERRA/ && $bulletin =~ /S|SIERRA/) ||
($btype =~ /T|TANGO/ && $bulletin =~ /T|TANGO/) ||
($btype =~ /Z|ZULU/ && $bulletin =~ /Z|ZULU/)) {
if ("${xml_yyyymmdd}${xml_hhmm}" ge "${yyyymmdd}${hhmm}") {
$updatecount++;
}
if ($hhmm eq "0245") {
last;
}
}
}
} else {
$updatecount = 1;
}
# Now update the Airmet Text Database
my $command = "xml2gairm4nmap.py -i $xmlfiles[0] --ofmt \"$ofmt\" --updatenum $updatecount --outhour $hour --append";
print "command = $command\n";
`xml2gairm4nmap.py -i $xmlfiles[0] --ofmt "$ofmt" --updatenum $updatecount --outhour $hour --bulletin $bulletin --append`;

chdir ($origdir);
`rm -rf ${tmpdir}`;

exit 0;

88 changes: 88 additions & 0 deletions scripts/decoder/parseltg_atdnet.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/usr/bin/perl -w
use strict;
use feature qw(switch);
no if $] >= 5.018, warnings => qw( experimental::smartmatch );
use Env;
########################################################################
#
# Usage: parseltg_atdnet.pl -i <file> -o <format specs>
#
# Purpose: Parse the GZipped Compressed ATDNet Lightning data received
# through LDM under SFUK45 EGRR header. This means stripping the header,
# unzipping the file, then running the GEMPAK decoder ltgdecode on it.
# ltgdecode needs the -G switch to parse this type of data.
#
# Inputs: Raw LDM SFUK45 EGRR header data that has been closed in LDM
#
# Outputs: Decoded Lightning data in longword format to specified path
# and output file format in -o switch
#
# Author: Larry J. Hinson, AWC 04/2011
#
########################################################################

my ($inputfile,$stdinsw,$inputsw,$outputformat,$usageStatement,$origdir);
my $rawbin;


if (($#ARGV+1) < 2) {
print "Usage: parseltg_atdnet.pl -i <file> -o <format specs>\n";
exit 1;
}

while ($#ARGV+1) {
given($ARGV[0]) {
when ("-i") {
if ($ARGV[1] ne "-") {
$inputfile = $ARGV[1];
} else {
$inputfile = "<&STDIN";
$stdinsw = 1;
}
$inputsw = "-1";
}
when ("-o") {
$outputformat = $ARGV[1];
}
when ("-h") {
print $usageStatement;
exit 1;
}
}
shift(@ARGV);
}
if (! $inputsw) {
print $usageStatement;
exit 1;
}

$origdir = $ENV{'PWD'};
if ($inputfile !~ /\// && ! $stdinsw) {
$inputfile = sprintf("%s/%s",$origdir,$inputfile);
}

my $tmpdir = "/var/tmp/parseltg_atdnet.pl.$$";
mkdir ($tmpdir, 0777);
chdir ($tmpdir);

#Copy file or stdin to file named 'input' in temp directory...
open (INFILE,"$inputfile") || die "Cannot open $inputfile";
open (OUTFILE, ">temp.raw") || die "Cannot open redirected file temp.raw";
binmode INFILE;
binmode OUTFILE;
while ( read (INFILE, $rawbin, 65536) ) {
print OUTFILE $rawbin;
}
close(INFILE);
close(OUTFILE);
# Now process temp.raw to gz file...
`dd if=temp.raw skip=31 bs=1 > temp.gz`;
`gunzip temp.gz >& /dev/null`;
# Now decode temp.gz store in format specified in outputformat...
`cat temp|ltgdecode -e -p 3600 -G -L -o $outputformat`;

# Process complete
chdir ($origdir);
`rm -rf ${tmpdir}`;
exit 0;

Loading

0 comments on commit 53233b1

Please sign in to comment.