diff --git a/CHANGELOG.md b/CHANGELOG.md index 693d11d1..1a75979a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,12 +13,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Fix for Open MPI calls in `esma_mpirun` from Open MPI 5 testing - ### Removed ### Deprecated +## [2.1.7] - 2026-04-15 + +### Added + +- Minor changes for VIIRS additions + +### Changed + +- Synced latest changes from branch GEOS-FP-5_44 into main + +### Fixed + +- Fix for Open MPI calls in `esma_mpirun` from Open MPI 5 testing + ## [2.1.6] - 2026-01-06 ### Fixed @@ -85,6 +97,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +2026-01-17: + +- added GOES, HIMAWARI, VIIRS SNPP & NOAA-20, and Lunar AERONET aerosol observations to the KX-lists + +2026-01-12: + +- r_dist for MILAN +- minor bug fix in ODS code +- add ak/bk for MLT 1st version +- add ability to write out akbk to nc4 (JEDI support) + +------------ - fix vED - SLES15 stuff - fix to reading of table in time ave program diff --git a/GMAO_etc/r_dist b/GMAO_etc/r_dist index c34753e2..c582f6be 100755 --- a/GMAO_etc/r_dist +++ b/GMAO_etc/r_dist @@ -401,8 +401,8 @@ return $put_rc; sub resolve { my ( $LOCALROOT,$REMOTEROOT,$expno,$yyyy,$yy,$mm,$dd,$hh,$file ) = @_; - $file =~ s/\${REMOTEROOT}/$REMOTEROOT/g; - $file =~ s/\${LOCALROOT}/$LOCALROOT/g; + $file =~ s/\$\{REMOTEROOT}/$REMOTEROOT/g; + $file =~ s/\$\{LOCALROOT}/$LOCALROOT/g; $file =~ s/%y4/$yyyy/g; $file =~ s/%y2/$yy/g; $file =~ s/%m2/$mm/g; diff --git a/GMAO_etc/setup_gaas_obs.pl b/GMAO_etc/setup_gaas_obs.pl deleted file mode 100755 index 1c4ca06b..00000000 --- a/GMAO_etc/setup_gaas_obs.pl +++ /dev/null @@ -1,87 +0,0 @@ -#!/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, $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); - } - } - -} - -#======================================================================= -# name - init -# purpose - get input parameters and flags -#======================================================================= -sub init { - use Getopt::Long; - - GetOptions( "v" => \$verbose, - "modis" => \$modis, - "avhrr" => \$avhrr ); - $workdir = shift @ARGV; - - $flags{"verbose"} = 1 if $verbose; -} diff --git a/GMAO_hermes/CMakeLists.txt b/GMAO_hermes/CMakeLists.txt index 16a47e3c..b06cc58c 100644 --- a/GMAO_hermes/CMakeLists.txt +++ b/GMAO_hermes/CMakeLists.txt @@ -15,7 +15,7 @@ if ( NOT HERMES_LIGHT ) m_insitu.F m_interp.F90 m_lp.F m_maph.F90 m_maph_pert.F90 m_mapz.F m_mapz_pert.F90 m_qsat.F m_remap.f90 m_set_eta.F90 m_vdc2vdc.F90 progsig.f90 shared_topo_remap.F90 m_topo_remap.F90 m_interpack.F m_interpack_ad.F m_ec_set_eta.F90 m_ecdyn.f90 m_tick.f90 - m_dyn_util.F90 m_spline.f90 m_nc_JEDIinc.f90 + m_dyn_util.F90 m_spline.f90 m_nc_JEDIinc.f90 m_nc_akbk.f90 ) esma_add_library(${this} SRCS ${srcs} DEPENDENCIES GMAO_mpeu GMAO_gfio_r8) diff --git a/GMAO_hermes/dyn2dyn.f90 b/GMAO_hermes/dyn2dyn.f90 index 29be9c2c..d89c4fd5 100644 --- a/GMAO_hermes/dyn2dyn.f90 +++ b/GMAO_hermes/dyn2dyn.f90 @@ -14,6 +14,7 @@ program dyn2dyn use m_dyn use m_set_eta, only : set_ncep72,unset_ncep72 use m_dyn2dyn, only : dyn2dyn_do + use m_topo_remap, only: dyn_topo_remap use m_StrTemplate ! grads style templates @@ -75,6 +76,7 @@ program dyn2dyn ! ------ character(len=255) msg character(len=255), pointer :: xtrnames(:) + character(len=255) phfile integer, parameter :: READ_ONLY = 1 integer fid, nvars, ngatts integer ier, ifile @@ -97,7 +99,7 @@ program dyn2dyn fakedate, nymdf, nhmsf, & dophys, expid, RCfile, verbose, oldana, force, & vectype, dgrid, ncep72, ncf, pncf, indxlevs, & - xtrnames ) + xtrnames, phfile ) ! Loop over input eta files @@ -155,6 +157,12 @@ program dyn2dyn end if if(ncep72) call set_ncep72 +! If topographic remap requested ... +! ---------------------------------- + if ( trim(phfile) /= "NONE" ) then + call dyn_topo_remap(trim(phfile), w_e, vectype, ier) + endif + ! Perform interpolation ! --------------------- if ( trim(RCfile)=='NONE' ) then @@ -211,7 +219,7 @@ subroutine Init_ ( mfiles, etafiles, nfiles, dynfile, lwifile, & fakedate, nymdf, nhmsf, & dophys, expid, RCfile, verbose, oldana, force, & vectype, dgrid, ncep72, ncf, pncf, indxlevs, & - xtrnames ) + xtrnames, phfile ) implicit NONE @@ -245,6 +253,7 @@ subroutine Init_ ( mfiles, etafiles, nfiles, dynfile, lwifile, & logical, intent(out) :: pncf ! non-complaint dyn-perturbation file knob logical, intent(out) :: indxlevs! index levels (in place of pressure levs) character(len=*), pointer :: xtrnames(:) + character(len=*) :: phfile ! ! !REVISION HISTORY: @@ -319,6 +328,7 @@ subroutine Init_ ( mfiles, etafiles, nfiles, dynfile, lwifile, & trnames = 'NONE' im_usr = -1 jm_usr = -1 + phfile = 'NONE' ! Parse command line ! ------------------ @@ -466,6 +476,10 @@ subroutine Init_ ( mfiles, etafiles, nfiles, dynfile, lwifile, & ncf = .true. case ('-pncf') pncf = .true. + case ("-phfile") + if ( iarg+1 .gt. argc ) call usage() + iarg = iarg + 1 + call GetArg ( iarg, phfile ) case ('-prec') if ( iarg+1 .gt. argc ) call usage() iarg = iarg + 1 @@ -604,6 +618,7 @@ subroutine usage() print *, '-ncf non-compliant dyn-vector (see NOTES)' print *, '-pncf non-compliant dyn-vector perturbation (see NOTES)' print *, '-tracers N,M read/write extra tracers of name N and M from ori file to new' + print *, '-phfile FNAME when alternative dyn-vec file provided, will perform topo-remap' print * print *, ' NOTES:' print *, ' 1) For the time being, in order to do horizontal' diff --git a/GMAO_hermes/eta_echo.f90 b/GMAO_hermes/eta_echo.f90 index 29c87c27..fea874a3 100644 --- a/GMAO_hermes/eta_echo.f90 +++ b/GMAO_hermes/eta_echo.f90 @@ -2,6 +2,7 @@ program eta_echo use m_set_eta, only: set_eta use m_set_eta, only: get_ref_plevs use m_spline, only: spline +use m_nc_akbk, only: write_nc_akbk implicit none integer :: nlevs,mlevs @@ -13,6 +14,7 @@ program eta_echo real(4) :: ak4,bk4 real(4) :: pbottom character(len=255) :: locfname +character(len=255) :: akbkfname call init_ @@ -28,7 +30,7 @@ program eta_echo call write_plevs_() endif -call write_akbk_() +if ( akbkfname /= "NULL" ) call write_nc_akbk ( akbkfname, ak8, bk8 ) deallocate(ak8,bk8) @@ -52,6 +54,7 @@ subroutine init_ print *, " -mlevs LEVS - interpolate to this level setting" print *, " -plevs - echoes pressure levels" print *, " -r4 - single precision" + print *, " -nc FILE - writes out ak/bk to nc4 file" print *, " " stop end if @@ -59,6 +62,7 @@ subroutine init_ lsingle = .false. lplevs = .false. locfname = "NULL" + akbkfname = "NULL" pbottom = -999. mlevs=0 iarg = 1 @@ -84,6 +88,10 @@ subroutine init_ iarg = iarg + 1 call GetArg ( iarg, argv ) locfname = trim(argv) + case ("-nc") + iarg = iarg + 1 + call GetArg ( iarg, argv ) + akbkfname = trim(argv) case default read(argv,*) nlevs end select diff --git a/GMAO_hermes/m_nc_akbk.f90 b/GMAO_hermes/m_nc_akbk.f90 new file mode 100644 index 00000000..7d8398c0 --- /dev/null +++ b/GMAO_hermes/m_nc_akbk.f90 @@ -0,0 +1,94 @@ +module m_nc_akbk +use netcdf +implicit none +private +public :: write_nc_akbk +interface write_nc_akbk + module procedure write_nc_akbk_ +end interface +integer :: mype_ = 0 +integer :: root_ = 0 +contains +subroutine write_nc_akbk_ (fname,ak, bk) + + character(len=*), intent(in) :: fname + double precision, intent(in) :: ak(:), bk(:) + + ! NetCDF variables + integer :: ncid, dimid_edge + integer :: varid_edge, varid_ak, varid_bk + integer :: rc + integer :: i, km + double precision, allocatable :: edge(:) + + km = size(ak) + allocate(edge(km)) + do i=1,km + edge(i) = dble(i) + enddo + + ! Create the NetCDF file + call check_( nf90_create(fname, NF90_CLOBBER, ncid), rc, mype_, root_ ) + if(rc/=0) return + + ! Define dimensions + call check_ ( nf90_def_dim(ncid, "edge", km, dimid_edge), rc, mype_, root_ ) + if(rc/=0) return + + ! Define variables + call check_ ( nf90_def_var(ncid, "edge", NF90_DOUBLE, (/dimid_edge/), varid_edge), rc, mype_, root_ ) + call check_ ( nf90_def_var(ncid, "ak", NF90_DOUBLE, (/dimid_edge/), varid_ak), rc, mype_, root_ ) + call check_ ( nf90_def_var(ncid, "bk", NF90_DOUBLE, (/dimid_edge/), varid_bk), rc, mype_, root_ ) + + ! Add attributes to edge + call check_ ( nf90_put_att(ncid, varid_edge, "units", "level"), rc, mype_, root_ ) + call check_ ( nf90_put_att(ncid, varid_edge, "long_name", "sigma at layer edges"), rc, mype_, root_ ) + call check_ ( nf90_put_att(ncid, varid_edge, "standard_name", "atmosphere_hybrid_sigma_pressure_coordinate"),& + rc, mype_, root_ ) + call check_ ( nf90_put_att(ncid, varid_edge, "coordinate", "eta"), rc, mype_, root_ ) + call check_ ( nf90_put_att(ncid, varid_edge, "positive", "down"), rc, mype_, root_ ) + call check_ ( nf90_put_att(ncid, varid_edge, "formulaTerms", "ap: ak b: bk ps: ps p0: p00"),& + rc, mype_, root_ ) + + ! Add attributes to ak + call check_ ( nf90_put_att(ncid, varid_ak, "long_name", "hybrid_sigma_pressure_a"),& + rc, mype_, root_ ) + call check_ ( nf90_put_att(ncid, varid_ak, "units", "Pa"), rc, mype_, root_ ) + + ! Add attributes to bk + call check_ ( nf90_put_att(ncid, varid_bk, "long_name", "hybrid_sigma_pressure_b"), & + rc, mype_, root_ ) + call check_ ( nf90_put_att(ncid, varid_bk, "units", "1"), rc, mype_, root_ ) + + ! Global attributes + call check_ ( nf90_put_att(ncid, NF90_GLOBAL, "NASA/GMAO", & + "Homepage = http://gmao.gfsc.nasa.gov/"), rc, mype_, root_ ) + + ! End define mode + call check_ ( nf90_enddef(ncid), rc, mype_, root_ ) + + ! Write data + call check_ ( nf90_put_var(ncid, varid_edge, edge), rc, mype_, root_ ) + call check_ ( nf90_put_var(ncid, varid_ak, ak), rc, mype_, root_ ) + call check_ ( nf90_put_var(ncid, varid_bk, bk), rc, mype_, root_ ) + + ! Close file + call check_ ( nf90_close(ncid), rc, mype_, root_ ) + + deallocate(edge) + + print *, "NetCDF file ",trim(fname)," written successfully." + +end subroutine write_nc_akbk_ +subroutine check_(status,rc, myid, root) + integer, intent ( in) :: status + integer, intent (out) :: rc + integer, intent ( in) :: myid, root + rc=0 + if(status /= nf90_noerr) then + if(myid==root) print *, trim(nf90_strerror(status)) + rc=999 + end if +end subroutine check_ +end module m_nc_akbk + diff --git a/GMAO_hermes/m_set_eta.F90 b/GMAO_hermes/m_set_eta.F90 index 149fd2d8..4571bc1b 100644 --- a/GMAO_hermes/m_set_eta.F90 +++ b/GMAO_hermes/m_set_eta.F90 @@ -91,7 +91,9 @@ subroutine set_eta_r8_(km, ks, ptop, pint, ak, bk) real(r8) a91(92), b91(92) real(r8) a137(138), b137(138) real(r8) a181(182), b181(182) - + real(r8) a186(187), b186(187) + real(r8) a187(188), b187(188) + ! NCEP real(r8) a64(65),b64(65), a64_sig(65),b64_sig(65) real(r8) a127(128),b127(128) @@ -884,6 +886,163 @@ subroutine set_eta_r8_(km, ks, ptop, pint, ak, bk) 0.985649, 0.988688, 0.991432, 0.993898, 0.996109, & 0.998114, 1.00000 / + data a186 /0.00025000, 0.00600000, 0.0500000, 0.20000, 0.5000000, & + 1.0000000, 1.6461494, 2.3988098, 3.3373925, 4.5180100, & + 5.9846950, 7.7937295, 10.010172, 12.710444, 15.973860, & + 19.886346, 24.538486, 30.024769, 36.447639, 43.915803, & + 52.545737, 62.453836, 73.764708, 86.607943, 101.11680, & + 117.42552, 135.67413, 156.00783, 178.57081, 203.51057, & + 230.97658, 261.12225, 294.09498, 330.04762, 369.13346, & + 411.50830, 457.32002, 506.71984, 559.85860, 616.88715, & + 677.95229, 743.20095, 812.77976, 886.82963, 965.49068, & + 1048.9029, 1137.2056, 1230.5308, 1329.0094, 1432.7708, & + 1541.9456, 1656.6555, 1777.0232, 1903.1678, 2035.2088, & + 2173.2571, 2317.4255, 2467.8252, 2624.5658, 2787.7489, & + 2957.4768, 3133.8507, 3316.9714, 3506.9325, 3703.8235, & + 3907.7214, 4118.6851, 4336.7484, 4561.9281, 4794.2279, & + 5033.6431, 5280.1592, 5533.7681, 5794.5055, 6062.4980, & + 6337.9868, 6621.3268, 6912.9118, 7213.1229, 7522.2804, & + 7840.7098, 8168.7861, 8506.9408, 8855.5426, 9214.7142, & + 9584.2399, 9963.5983, 10352.111, 10748.987, 11153.318, & + 11564.007, 11979.737, 12399.133, 12820.830, 13243.570, & + 13665.922, 14086.428, 14503.591, 14916.111, 15322.602, & + 15721.715, 16112.059, 16492.407, 16861.516, 17218.218, & + 17561.331, 17889.768, 18202.451, 18498.379, 18776.566, & + 19036.070, 19275.971, 19495.400, 19693.530, 19869.553, & + 20022.686, 20152.202, 20257.406, 20337.620, 20392.130, & + 20420.286, 20421.458, 20395.044, 20340.425, 20257.007, & + 20144.234, 20001.538, 19828.378, 19624.186, 19388.455, & + 19120.682, 18820.454, 18487.599, 18122.389, 17725.721, & + 17299.086, 16844.410, 16363.835, 15859.595, 15334.131, & + 14790.135, 14230.490, 13658.113, 13075.906, 12486.888, & + 11894.071, 11300.423, 10708.651, 10121.401, 9541.1803, & + 8970.3675, 8411.0514, 7865.0798, 7334.1450, 6819.7266, & + 6323.0938, 5845.2210, 5386.9040, 4948.7590, 4531.2215, & + 4134.5581, 3758.8643, 3404.0995, 3070.1029, 2756.5979, & + 2463.2467, 2189.6016, 1935.1705, 1699.3937, 1481.6793, & + 1281.4331, 1098.0062, 930.81258, 779.20329, 642.64526, & + 520.55054, 412.42879, 317.77547, 236.18368, 167.34212, & + 111.00464, 67.106120, 35.426839, 15.342204, 4.8543294, & + 0.89721680, 0.0000000 / + + data b186 /0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 8.66281e-07, 4.30872e-06, & + 1.23622e-05, 2.78373e-05, 5.24551e-05, 8.85466e-05, 0.000139698, & + 0.000213463, 0.000319596, 0.000468744, 0.000671591, 0.000940946, & + 0.00129107, 0.00173889, 0.00230345, 0.00300141, 0.00384951, & + 0.00486404, 0.00606625, 0.00747397, 0.00910526, 0.0109764, & + 0.0131071, 0.0155140, 0.0182150, 0.0212261, 0.0245646, & + 0.0282452, 0.0322847, 0.0366982, 0.0415011, 0.0467072, & + 0.0523312, 0.0583875, 0.0648898, 0.0718511, 0.0792848, & + 0.0872044, 0.0956224, 0.104550, 0.114000, 0.123985, & + 0.134518, 0.145609, 0.157270, 0.169514, 0.182353, & + 0.195797, 0.209857, 0.224545, 0.239873, 0.255851, & + 0.272491, 0.289803, 0.307785, 0.326419, 0.345659, & + 0.365435, 0.385673, 0.406299, 0.427248, 0.448454, & + 0.469840, 0.491328, 0.512844, 0.534317, 0.555677, & + 0.576847, 0.597762, 0.618360, 0.638587, 0.658385, & + 0.677706, 0.696509, 0.714758, 0.732423, 0.749476, & + 0.765898, 0.781674, 0.796796, 0.811257, 0.825057, & + 0.838199, 0.850689, 0.862535, 0.873752, 0.884352, & + 0.894353, 0.903769, 0.912623, 0.920933, 0.928720, & + 0.936005, 0.942807, 0.949150, 0.955052, 0.960536, & + 0.965618, 0.970318, 0.974655, 0.978647, 0.982307, & + 0.985649, 0.988688, 0.991432, 0.993898, 0.996109, & + 0.998114, 1.00000 / + + data a187 /0.0000300, 0.00049276, 0.00435689, 0.0230675, 0.0831358, 0.231856, & + 1.0000000, 1.6461494, 2.3988098, 3.3373925, 4.5180100, & + 5.9846950, 7.7937295, 10.010172, 12.710444, 15.973860, & + 19.886346, 24.538486, 30.024769, 36.447639, 43.915803, & + 52.545737, 62.453836, 73.764708, 86.607943, 101.11680, & + 117.42552, 135.67413, 156.00783, 178.57081, 203.51057, & + 230.97658, 261.12225, 294.09498, 330.04762, 369.13346, & + 411.50830, 457.32002, 506.71984, 559.85860, 616.88715, & + 677.95229, 743.20095, 812.77976, 886.82963, 965.49068, & + 1048.9029, 1137.2056, 1230.5308, 1329.0094, 1432.7708, & + 1541.9456, 1656.6555, 1777.0232, 1903.1678, 2035.2088, & + 2173.2571, 2317.4255, 2467.8252, 2624.5658, 2787.7489, & + 2957.4768, 3133.8507, 3316.9714, 3506.9325, 3703.8235, & + 3907.7214, 4118.6851, 4336.7484, 4561.9281, 4794.2279, & + 5033.6431, 5280.1592, 5533.7681, 5794.5055, 6062.4980, & + 6337.9868, 6621.3268, 6912.9118, 7213.1229, 7522.2804, & + 7840.7098, 8168.7861, 8506.9408, 8855.5426, 9214.7142, & + 9584.2399, 9963.5983, 10352.111, 10748.987, 11153.318, & + 11564.007, 11979.737, 12399.133, 12820.830, 13243.570, & + 13665.922, 14086.428, 14503.591, 14916.111, 15322.602, & + 15721.715, 16112.059, 16492.407, 16861.516, 17218.218, & + 17561.331, 17889.768, 18202.451, 18498.379, 18776.566, & + 19036.070, 19275.971, 19495.400, 19693.530, 19869.553, & + 20022.686, 20152.202, 20257.406, 20337.620, 20392.130, & + 20420.286, 20421.458, 20395.044, 20340.425, 20257.007, & + 20144.234, 20001.538, 19828.378, 19624.186, 19388.455, & + 19120.682, 18820.454, 18487.599, 18122.389, 17725.721, & + 17299.086, 16844.410, 16363.835, 15859.595, 15334.131, & + 14790.135, 14230.490, 13658.113, 13075.906, 12486.888, & + 11894.071, 11300.423, 10708.651, 10121.401, 9541.1803, & + 8970.3675, 8411.0514, 7865.0798, 7334.1450, 6819.7266, & + 6323.0938, 5845.2210, 5386.9040, 4948.7590, 4531.2215, & + 4134.5581, 3758.8643, 3404.0995, 3070.1029, 2756.5979, & + 2463.2467, 2189.6016, 1935.1705, 1699.3937, 1481.6793, & + 1281.4331, 1098.0062, 930.81258, 779.20329, 642.64526, & + 520.55054, 412.42879, 317.77547, 236.18368, 167.34212, & + 111.00464, 67.106120, 35.426839, 15.342204, 4.8543294, & + 0.89721680, 0.0000000 / + + data b187 /0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, & + 8.66281e-07, 4.30872e-06, & + 1.23622e-05, 2.78373e-05, 5.24551e-05, 8.85466e-05, 0.000139698, & + 0.000213463, 0.000319596, 0.000468744, 0.000671591, 0.000940946, & + 0.00129107, 0.00173889, 0.00230345, 0.00300141, 0.00384951, & + 0.00486404, 0.00606625, 0.00747397, 0.00910526, 0.0109764, & + 0.0131071, 0.0155140, 0.0182150, 0.0212261, 0.0245646, & + 0.0282452, 0.0322847, 0.0366982, 0.0415011, 0.0467072, & + 0.0523312, 0.0583875, 0.0648898, 0.0718511, 0.0792848, & + 0.0872044, 0.0956224, 0.104550, 0.114000, 0.123985, & + 0.134518, 0.145609, 0.157270, 0.169514, 0.182353, & + 0.195797, 0.209857, 0.224545, 0.239873, 0.255851, & + 0.272491, 0.289803, 0.307785, 0.326419, 0.345659, & + 0.365435, 0.385673, 0.406299, 0.427248, 0.448454, & + 0.469840, 0.491328, 0.512844, 0.534317, 0.555677, & + 0.576847, 0.597762, 0.618360, 0.638587, 0.658385, & + 0.677706, 0.696509, 0.714758, 0.732423, 0.749476, & + 0.765898, 0.781674, 0.796796, 0.811257, 0.825057, & + 0.838199, 0.850689, 0.862535, 0.873752, 0.884352, & + 0.894353, 0.903769, 0.912623, 0.920933, 0.928720, & + 0.936005, 0.942807, 0.949150, 0.955052, 0.960536, & + 0.965618, 0.970318, 0.974655, 0.978647, 0.982307, & + 0.985649, 0.988688, 0.991432, 0.993898, 0.996109, & + 0.998114, 1.00000 / + ! GFS 127-levels data a127 /1.0000000, 1.6100000, 2.5300000, 3.9200001, 5.9800000, & 8.9499998, 13.179999, 19.100000, 27.240000, 38.280003, & @@ -1164,8 +1323,19 @@ subroutine set_eta_r8_(km, ks, ptop, pint, ak, bk) ak(k) = a181(k) bk(k) = b181(k) end do + + case (186) + do k=1,km+1 + ak(k) = a186(k) + bk(k) = b186(k) + enddo - + case (187) + do k=1,km+1 + ak(k) = a187(k) + bk(k) = b187(k) + end do + end select ! This select case is to set the ks output integer. In most cases, this is diff --git a/GMAO_hermes/m_topo_remap.F90 b/GMAO_hermes/m_topo_remap.F90 index 69ca44e5..5a8a8877 100644 --- a/GMAO_hermes/m_topo_remap.F90 +++ b/GMAO_hermes/m_topo_remap.F90 @@ -13,6 +13,7 @@ module m_topo_remap use m_dyn use shared_topo_remap, only : dyn_topo_remap, gmap +use m_die, only: die implicit none private @@ -22,6 +23,7 @@ module m_topo_remap ! interface dyn_topo_remap + module procedure dyn_topo_remap0_ module procedure dyn_topo_remap_ end interface interface dyn_real_eta @@ -49,6 +51,34 @@ module m_topo_remap !EOP !------------------------------------------------------------------------- CONTAINS + subroutine dyn_topo_remap0_(fname, w_f, dyntype, rc) + implicit none + character(len=*), intent(in) :: fname + type(dyn_vect) w_f + integer, intent(in) :: dyntype + integer, intent(out) :: rc + + character(len=*), parameter :: myname_ = myname//'*dyn_topo_remap0_' + integer nymd, nhms + type(dyn_vect) w_p + + ! assume file w/ alternative phis is dyn-vect (can generalize later) + call dyn_get ( trim(fname), nymd, nhms, w_p, rc, timidx=1, vectype=dyntype ) + if (rc/=0) then + call die(myname_,'failed getting topo to remap to' ) + else + print *, "read topo to remap to from: ", trim(fname) + endif + + if ( w_p%grid%im == w_f%grid%im .and. w_p%grid%jm == w_f%grid%jm ) then + call dyn_topo_remap ( w_f, w_p%phis, dyntype, info=rc ) + else + call die(myname_,'inconsistent dimensions' ) + endif + print *, "Topo remap done" + + end subroutine dyn_topo_remap0_ + subroutine dyn_topo_remap_( w_f,phis_new, dyntype, info ) implicit none integer,intent(in) :: dyntype diff --git a/GMAO_ods/kx_list.rc b/GMAO_ods/kx_list.rc index 91f993c1..f8b28b0e 100644 --- a/GMAO_ods/kx_list.rc +++ b/GMAO_ods/kx_list.rc @@ -335,6 +335,28 @@ kx_list:: 324 AVHRR PATMOSX Aerosol Retrievals 325 OMSO2 (OMI SULFER DIOXIDE) 326 GOCI Aerosol Retrievals (Yonsei University) + 327 GOES-16 Aerosol (Dark Target Ocean Algorithm) + 328 GOES-16 Aerosol (Dark Target Land Algorithm) + 329 GOES-17 Aerosol (Dark Target Ocean Algorithm) + 330 GOES-17 Aerosol (Dark Target Land Algorithm) + 331 Himawari Aerosol (Dark Target Ocean Algorithm) + 332 Himawari Aerosol (Dark Target Land Algorithm) + 333 VIIRS SNPP Aerosol (Deep Blue Land Algorithm) + 334 VIIRS SNPP Aerosol (Deep Blue Ocean Algorithm) + 335 VIIRS SNPP Aerosol (Dark Blue Deep Algorithm) + 336 VIIRS SNPP Aerosol (Dark Target Land Algorithm) + 337 VIIRS SNPP Aerosol (Dark Target Ocean Algorithm) + 338 VIIRS NOAA-20 Aerosol (Deep Blue Land Algorithm) + 339 VIIRS NOAA-20 Aerosol (Deep Blue Ocean Algorithm) + 340 VIIRS NOAA-20 Aerosol (Deep Blue Deep Algorithm) + 341 VIIRS NOAA-20 Aerosol (Dark Target Land Algorithm) + 342 VIIRS NOAA-20 Aerosol (Dark Target Ocean Algorithm) + 343 Lunar AERONET Aerosol Retrievals + 344 VIIRS NOAA-21 Aerosol (Deep Blue Land Algorithm) + 345 VIIRS NOAA-21 Aerosol (Deep Blue Ocean Algorithm) + 346 VIIRS NOAA-21 Aerosol (Deep Blue Deep Algorithm) + 347 VIIRS NOAA-21 Aerosol (Dark Target Land Algorithm) + 348 VIIRS NOAA-21 Aerosol (Dark Target Ocean Algorithm) :: # Notes: diff --git a/GMAO_ods/pyods/odsreader.py b/GMAO_ods/pyods/odsreader.py new file mode 100644 index 00000000..2a6ec360 --- /dev/null +++ b/GMAO_ods/pyods/odsreader.py @@ -0,0 +1,70 @@ +""" + +Very minimalistic ODS reader. + +""" + +VARS = ['lon', 'lat', 'lev', 'time', 'obs', 'qcexcl'] +EXTRA = ['kt', 'kx', 'ks', 'qchist', 'xm', 'xvec', 'omf', 'oma'] + + +from netCDF4 import Dataset + +from numpy import array +from datetime import timedelta +from dateutil.parser import parse as isoparser + +class ODSreader(object): + + def __init__ (self, filename, Extra=None): + """ + Read select attributes from an ODS file. + """ + + nc = Dataset(filename) + + Vars = VARS + if Extra is not None: + Vars += Extra + + self._getVars(nc,Vars) + + self.nobs = len(self.lon) + + # Create python time + # ------------------ + tunits = nc.variables['time'].units + onemin = timedelta(minutes=1) + toff = isoparser(tunits.split(' since ')[1].replace(' ','T')) + t = array([toff + self.time[i] * onemin for i in range(self.nobs)]) + + self.time = t # array of python datetime objects + + def _getVars(self,nc,Vars): + """ + Read and flatten variables on file. + Assuems 1 synoptic time per file. + """ + for name in Vars: + v = nc.variables[name] + q = v[:,:] + try: + q = q * v.scale_factor + except: + pass + try: + q = q + v.add_offset + except: + pass + + I = q.mask==False # not fill values + self.__dict__[name] = q[I].data + +#------------- + +if __name__ == "__main__": + + m = ODSreader('nnr_002.MOD04_L2a.land.20140119_0300z.ods') + + for i in range(m.nobs): + print("%6.2f %6.2f %s %7.4f"%(m.lon[i],m.lat[i],m.time[i].isoformat(),m.obs[i])) diff --git a/GMAO_ods/pyods_.F90 b/GMAO_ods/pyods_.F90 index b3cc3acf..8bfd642f 100644 --- a/GMAO_ods/pyods_.F90 +++ b/GMAO_ods/pyods_.F90 @@ -624,6 +624,28 @@ subroutine pyods_putAll(filename, ftype, nymd,nhms, nsyn, nobs, & ods%meta%kx_names(324) = 'AVHRR PATMOSX Aerosol Retrievals' ods%meta%kx_names(325) = 'OMSO2 (OMI Sulfer Dioxide)' ods%meta%kx_names(326) = 'GOCI Aerosol Retrievals (Yonsei University)' + ods%meta%kx_names(327) = 'GOES-16 Aerosol (Dark Target Ocean Algorithm)' + ods%meta%kx_names(328) = 'GOES-16 Aerosol (Dark Target Land Algorithm)' + ods%meta%kx_names(329) = 'GOES-17 Aerosol (Dark Target Ocean Algorithm)' + ods%meta%kx_names(330) = 'GOES-17 Aerosol (Dark Target Land Algorithm)' + ods%meta%kx_names(331) = 'Himawari Aerosol (Dark Target Ocean Algorithm)' + ods%meta%kx_names(332) = 'Himawari Aerosol (Dark Target Land Algorithm)' + ods%meta%kx_names(333) = 'VIIRS SNPP Aerosol (Deep Blue Land Algorithm)' + ods%meta%kx_names(334) = 'VIIRS SNPP Aerosol (Deep Blue Ocean Algorithm)' + ods%meta%kx_names(335) = 'VIIRS SNPP Aerosol (Deep Blue Deep Algorithm)' + ods%meta%kx_names(336) = 'VIIRS SNPP Aerosol (Dark Target Land Algorithm)' + ods%meta%kx_names(337) = 'VIIRS SNPP Aerosol (Dark Target Ocean Algorithm)' + ods%meta%kx_names(338) = 'VIIRS NOAA-20 Aerosol (Deep Blue Land Algorithm)' + ods%meta%kx_names(339) = 'VIIRS NOAA-20 Aerosol (Deep Blue Ocean Algorithm)' + ods%meta%kx_names(340) = 'VIIRS NOAA-20 Aerosol (Deep Blue Deep Algorithm)' + ods%meta%kx_names(341) = 'VIIRS NOAA-20 Aerosol (Dark Target Land Algorithm)' + ods%meta%kx_names(342) = 'VIIRS NOAA-20 Aerosol (Dark Target Ocean Algorithm)' + ods%meta%kx_names(343) = 'Lunar AERONET Aerosol Retrievals' + ods%meta%kx_names(344) = 'VIIRS NOAA-21 Aerosol (Deep Blue Land Algorithm)' + ods%meta%kx_names(345) = 'VIIRS NOAA-21 Aerosol (Deep Blue Ocean Algorithm)' + ods%meta%kx_names(346) = 'VIIRS NOAA-21 Aerosol (Deep Blue Deep Algorithm)' + ods%meta%kx_names(347) = 'VIIRS NOAA-21 Aerosol (Dark Target Land Algorithm)' + ods%meta%kx_names(348) = 'VIIRS NOAA-21 Aerosol (Dark Target Ocean Algorithm)' call ods_put (filename, ftype, nymd, nhms, ods, rc) if ( rc .ne. 0 ) return diff --git a/GMAO_transf/CMakeLists.txt b/GMAO_transf/CMakeLists.txt index c711774b..15f824a9 100644 --- a/GMAO_transf/CMakeLists.txt +++ b/GMAO_transf/CMakeLists.txt @@ -96,11 +96,11 @@ set (srcs set (CMAKE_Fortran_FLAGS_RELEASE "-O3 ${common_Fortran_flags} ${ALIGNCOM} ${MISMATCH}") set (CMAKE_Fortran_FLAGS_DEBUG "${GEOS_Fortran_FLAGS_DEBUG}") -ecbuild_add_executable(TARGET dyn_divo.x SOURCES dyn_divo.F90 LIBS ${this} GMAO_mpeu GMAO_hermes NCEP_w3_r8i4 NCEP_sp_r8i4 FFLAGS "${FREAL8}") -ecbuild_add_executable(TARGET ec2fv.x SOURCES ec2fv.F90 LIBS ${this} GMAO_mpeu GMAO_hermes NCEP_w3_r8i4 NCEP_sp_r8i4 FFLAGS "${FREAL8}") -ecbuild_add_executable(TARGET fv2ss.x SOURCES fv2ss.f90 LIBS ${this} GMAO_mpeu GMAO_hermes NCEP_w3_r8i4 NCEP_sp_r8i4 FFLAGS "${FREAL8}") -ecbuild_add_executable(TARGET g4tog5.x SOURCES g4tog5.f90 LIBS ${this} GMAO_mpeu GMAO_hermes NCEP_w3_r8i4 NCEP_sp_r8i4 FFLAGS "${FREAL8}") -ecbuild_add_executable(TARGET ss2fv.x SOURCES ss2fv.f90 LIBS ${this} GMAO_mpeu GMAO_hermes NCEP_w3_r8i4 NCEP_sp_r8i4 FFLAGS "${FREAL8}") +ecbuild_add_executable(TARGET dyn_divo.x SOURCES dyn_divo.F90 LIBS ${this} GMAO_eu GMAO_hermes NCEP_w3_r8i4 NCEP_sp_r8i4 FFLAGS "${FREAL8}") +ecbuild_add_executable(TARGET ec2fv.x SOURCES ec2fv.F90 LIBS ${this} GMAO_eu GMAO_hermes NCEP_w3_r8i4 NCEP_sp_r8i4 FFLAGS "${FREAL8}") +ecbuild_add_executable(TARGET fv2ss.x SOURCES fv2ss.f90 LIBS ${this} GMAO_eu GMAO_hermes NCEP_w3_r8i4 NCEP_sp_r8i4 FFLAGS "${FREAL8}") +ecbuild_add_executable(TARGET g4tog5.x SOURCES g4tog5.f90 LIBS ${this} GMAO_eu GMAO_hermes NCEP_w3_r8i4 NCEP_sp_r8i4 FFLAGS "${FREAL8}") +ecbuild_add_executable(TARGET ss2fv.x SOURCES ss2fv.f90 LIBS ${this} GMAO_eu GMAO_hermes NCEP_w3_r8i4 NCEP_sp_r8i4 FFLAGS "${FREAL8}") install (PROGRAMS ec2fv.csh DESTINATION bin) diff --git a/GMAO_transf/dyn_divo.F90 b/GMAO_transf/dyn_divo.F90 index 49d36b36..00866898 100644 --- a/GMAO_transf/dyn_divo.F90 +++ b/GMAO_transf/dyn_divo.F90 @@ -1,5 +1,4 @@ program dyn_vordiv -! must run as mpirun -np 1 use m_ggGradientSP,only : ggGradientSP use m_ggGradientSP,only : ggGradientSP_init,clean use m_ggGradientSP,only : ggDivo @@ -19,7 +18,11 @@ program dyn_vordiv use m_dyn, only: dyn_stat use m_dyn, only: dyn_flip - use m_die, only: die + use m_mpif90,only : MP_init + use m_mpif90,only : MP_finalize + use m_mpif90,only : MP_comm_rank + + use m_die, only: MP_die,die implicit none @@ -48,48 +51,64 @@ program dyn_vordiv integer, parameter :: mfiles=2 integer iargc,nfiles integer iarg,argc,nymd,nhms,freq - integer im,jm,km,jcap + integer im,jm,km,lm,jcap integer i,ierr logical sfvp logical overwrite + logical getrh + logical pncf +! MPI Initialization +! ------------------ + call MP_init(ierr) + if(ierr/=0) call MP_die(myname,'MP_init()',ierr) + argc = iargc() if ( argc < 1 ) then call usage_() end if + iarg=0 nfiles=0 overwrite = .true. sfvp=.false. + getrh = .false. + pncf = .false. do i = 1, 32767 iarg = iarg + 1 if ( iarg .gt. argc ) exit call GetArg ( iarg, argv ) select case (argv) - case ("-noverw") - overwrite = .false. - case ("-jcap") + case ("-noverw") + overwrite = .false. + case ("-getrh") + getrh = .true. + case ("-pncf") + pncf = .true. + case ("-jcap") if ( iarg+1 .gt. argc ) call usage_() iarg = iarg + 1 call GetArg ( iarg, argv ) read(argv,*) jcap sfvp=.true. - case default + case default nfiles = nfiles + 1 if ( nfiles .gt. mfiles ) call die(myname,'too many eta files') if (nfiles == 1) ifile = trim(argv) if (nfiles == 2) ofile = trim(argv) end select - - enddo print*, "Reading file: ", trim(ifile) - allocate(xtrnames(2)) - xtrnames=(/'rh ','mrh'/) - call dyn_get ( trim(ifile), nymd, nhms, dyn, ierr, timidx=1, freq=freq, vectype=5, xtrnames=xtrnames ) - deallocate(xtrnames) + if (getrh) then + allocate(xtrnames(2)) + xtrnames=(/'rh ','mrh'/) + call dyn_get ( trim(ifile), nymd, nhms, dyn, ierr, timidx=1, freq=freq, vectype=5, pncf=pncf, xtrnames=xtrnames ) + deallocate(xtrnames) + else + call dyn_get ( trim(ifile), nymd, nhms, dyn, ierr, timidx=1, freq=freq, vectype=5, pncf=pncf ) + endif im = dyn%grid%im jm = dyn%grid%jm @@ -165,6 +184,11 @@ program dyn_vordiv deallocate( sf, vp, stat=ierr) deallocate(div,vor, stat=ierr) +! finalize +! -------- + call MP_finalize(ierr) + if(ierr/=0) call MP_die(myname,'MP_finalized()',ierr) + contains subroutine get_latlon_ implicit none @@ -217,6 +241,8 @@ subroutine usage_ print *, " Options: " print *, " -jcap JCAP - set truncation (triggers calc vp/sf)" print *, " -noverw - do not overwrite u/v w/ vp/sf" + print *, " -getrh - in case input has rh/mrh fields" + print *, " -pncf - in case input in non-compliant perturbation" print * stop end subroutine usage_