Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### Changed

- Minor changes to get VIIRS to work in ADAS v5.43x
- Move setup_gaas_obs.pl from GMAO_Etc here for consistency

## [v1.4.0] 2025-12-03

Expand Down
6 changes: 6 additions & 0 deletions src/Applications/GAAS_App/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ install(
DESTINATION lib/Python
)

file(GLOB perl_files *.pl)
file(GLOB pcf_files *.pcf)

install (
FILES ${pcf_files}
DESTINATION etc
)

install (
FILES ${perl_files}
DESTINATION bin
)

### MODIS
set(pythonscripts modis/modis_l2a.py modis/mxd04_l2a.py)
install(PROGRAMS ${pythonscripts} DESTINATION bin)
Expand Down
106 changes: 106 additions & 0 deletions src/Applications/GAAS_App/setup_gaas_obs.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/usr/bin/env perl
#=======================================================================
# name - setup_gaas_obs
# purpose - organize GAAS observation data into subdirectories expected
# by the reading program
#
# runtime parameter
# => $workdir: directory location of modis data
#
# runtime flags (choose at least one)
# => $avhrr: organize avhrr patmosx data into subdirectories
# => $modis: organize modis Level2 HDF data into subdirectories
#=======================================================================
use strict;
use warnings;

# global variables
#-----------------
my ($workdir, $modis, $viirs, $avhrr, %flags, $verbose);

# main program
#-------------
{
use File::Basename ("basename");
use File::Copy ("move");
use File::Path ("mkpath");

my ($file, $base, $adflg);
my ($label, $Adate, $time, $version);
my ($type, $jdoy, $subdir);
my ($year, $month, $day);

init();
if ($modis) {
foreach $file (<$workdir/M?D04_L2.*.*.hdf>) {
$base = basename $file;
($label, $Adate, $time, $version) = split /[\.]/, $base;

$type = substr($label, 0, 5);
$year = substr($Adate, 1, 4);
$jdoy = substr($Adate, 5, 3);

$subdir = "$workdir/$version/$type/$year/$jdoy";
unless (-d $subdir) {
mkpath($subdir, \%flags) or die "Error making dir: $subdir;";
system("touch $subdir/.no_archiving");
}
print "mv $file $subdir\n" if $verbose;
move($file, $subdir);
}
}

if ($avhrr) {
foreach $file (<$workdir/patmosx_v05r02.*.npz>) {
$base = basename $file;
($label, $adflg, $Adate) = split /[\.]/, $base;

$year = substr($Adate, 0, 4);
$month = substr($Adate, 4, 2);
$day = substr($Adate, 6, 2);

$subdir = "$workdir/Y$year/M$month/D$day";
unless (-d $subdir) {
mkpath($subdir, \%flags) or die "Error making dir: $subdir;";
system("touch $subdir/.no_archiving");
}
print "mv $file $subdir\n" if $verbose;
move($file, $subdir);
}
}

if ($viirs) {
foreach $file (<$workdir/VN20AERD?_L2_VIIRS_NOAA20.*.*.nc>) {
$base = basename $file;
($label, $Adate, $time, $version) = split /[\.]/, $base;

$type = substr($label, 0, 9);
$year = substr($Adate, 1, 4);
$jdoy = substr($Adate, 5, 3);

$subdir = "$workdir/${type}/$version/$year/$jdoy";
unless (-d $subdir) {
mkpath($subdir, \%flags) or die "Error making dir: $subdir;";
system("touch $subdir/.no_archiving");
}
print "mv $file $subdir\n" if $verbose;
move($file, $subdir);
}
}
}

#=======================================================================
# name - init
# purpose - get input parameters and flags
#=======================================================================
sub init {
use Getopt::Long;

GetOptions( "v" => \$verbose,
"viirs" => \$viirs,
"modis" => \$modis,
"avhrr" => \$avhrr );
$workdir = shift @ARGV;

$flags{"verbose"} = 1 if $verbose;
}