Skip to content

Commit

Permalink
Adds recentering task script and methods, with ctests (#968)
Browse files Browse the repository at this point in the history
Resolves #912

---------

Co-authored-by: Guillaume Vernieres <guillaume.vernieres@noaa.gov>
  • Loading branch information
AndrewEichmann-NOAA and guillaumevernieres authored Mar 13, 2024
1 parent 82e16bb commit d18b322
Show file tree
Hide file tree
Showing 8 changed files with 379 additions and 4 deletions.
102 changes: 102 additions & 0 deletions parm/soca/berror/soca_ensrecenter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# This yaml is for applying deterministic recentering increments to the ensemble members

geometry:
mom6_input_nml: mom_input.nml
fields metadata: ./fields_metadata.yaml

date: '{{ ATM_WINDOW_BEGIN }}'

layers variable: [hocn]

increment variables: [tocn, socn, uocn, vocn, ssh, hocn, cicen, hicen, hsnon]

set increment variables to zero: [ssh]

vertical geometry:
date: '{{ ATM_WINDOW_BEGIN }}'
basename: ./INPUT/
ocn_filename: MOM.res.nc
read_from_file: 3

add recentering increment: false

soca increments: # Could also be states, but they are read as increments
number of increments: {{ NMEM_ENS }}
pattern: '%mem%'
template:
date: '{{ ATM_WINDOW_BEGIN }}'
basename: ./ens/
ocn_filename: 'ocean.%mem%.nc'
ice_filename: 'ice.%mem%.nc'
read_from_file: 3

steric height:
linear variable changes:
- linear variable change name: BalanceSOCA # Only the steric balance is applied

#ensemble mean output:
# datadir: ./static_ens
# date: '{{ ATM_WINDOW_BEGIN }}'
# exp: ens_mean
# type: incr

ssh output:
unbalanced:
datadir: ./
date: '{{ ATM_WINDOW_BEGIN }}'
exp: ssh_unbal_stddev
type: incr

steric:
datadir: ./
date: '{{ ATM_WINDOW_BEGIN }}'
exp: ssh_steric_stddev
type: incr

total:
datadir: ./
date: '{{ ATM_WINDOW_BEGIN }}'
exp: ssh_total_stddev
type: incr

explained variance:
datadir: ./
date: '{{ ATM_WINDOW_BEGIN }}'
exp: steric_explained_variance
type: incr

recentering error:
datadir: ./
date: '{{ ATM_WINDOW_BEGIN }}'
exp: ssh_recentering_error
type: incr

background error output:
datadir: ./
date: '{{ ATM_WINDOW_BEGIN }}'
exp: bkgerr_stddev
type: incr

#linear variable change:
# linear variable changes:
# - linear variable change name: BkgErrFILT
# ocean_depth_min: 500 # zero where ocean is shallower than 500m
# rescale_bkgerr: 1.0 # rescale perturbation
# efold_z: 1500.0 # Apply exponential decay
# - linear variable change name: BalanceSOCA

trajectory:
state variables: [tocn, socn, uocn, vocn, ssh, hocn, layer_depth, mld, cicen, hicen, hsnon]
date: '{{ ATM_WINDOW_BEGIN }}'
basename: ./INPUT/
ocn_filename: MOM.res.nc
ice_filename: cice.res.nc
read_from_file: 1

output increment:
datadir: ./
date: '{{ ATM_WINDOW_BEGIN }}'
exp: trash
type: incr
output file: 'ocn.recenter.incr.%mem%.nc'
pattern: '%mem%'
1 change: 1 addition & 0 deletions parm/soca/obsprep/obsprep_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ observations:
window:
back: 8 # look back 8 six-hourly obs dumps
forward: 1 # look forward 1 six-hourly bin
error ratio: 0.4 # meters per day

# Ice concentration
- obs space:
Expand Down
25 changes: 25 additions & 0 deletions scripts/exgdas_global_marine_analysis_ecen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
# exgdas_global_marine_analysis_ecen.py
# This script creates an MarineRecenter class
# and runs the initialize, run, and finalize methods
# which currently are stubs
import os

from wxflow import Logger, cast_strdict_as_dtypedict
# TODO (AFE): change to from pygfs.task.marine_recenter import MarineRecenter
from soca.marine_recenter import MarineRecenter

# Initialize root logger
logger = Logger(level='DEBUG', colored_log=True)


if __name__ == '__main__':

# Take configuration from environment and cast it as python dictionary
config = cast_strdict_as_dtypedict(os.environ)

# Instantiate the aerosol analysis task
MarineRecen = MarineRecenter(config)
MarineRecen.initialize()
MarineRecen.run()
MarineRecen.finalize()
1 change: 1 addition & 0 deletions test/soca/gw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ set(jjob_list "JGLOBAL_PREP_OCEAN_OBS"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_PREP"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_BMAT"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_RUN"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_ECEN"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_CHKPT"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_POST"
"JGDAS_GLOBAL_OCEAN_ANALYSIS_VRFY")
Expand Down
1 change: 1 addition & 0 deletions test/soca/gw/run_jjobs.yaml.test
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ gw environement:

run scripts:
GDASPREPOCNOBSPY: @HOMEgfs@/sorc/gdas.cd/scripts/exglobal_prep_ocean_obs.py
GDASOCNCENPY: @HOMEgfs@/sorc/gdas.cd/scripts/exgdas_global_marine_analysis_ecen.py

setup_expt config:
base:
Expand Down
4 changes: 2 additions & 2 deletions ush/soca/bkg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ def gen_bkg_list(bkg_path, out_path, window_begin=' ', yaml_name='bkg.yaml', ice
bkg_date = window_begin

# Construct list of background file names
GDUMP = os.getenv('GDUMP')
RUN = os.getenv('RUN')
cyc = str(os.getenv('cyc')).zfill(2)
gcyc = str((int(cyc) - 6) % 24).zfill(2) # previous cycle
fcst_hrs = list(range(3, 10, dt_pseudo))
files = []
for fcst_hr in fcst_hrs:
files.append(os.path.join(bkg_path, f'{GDUMP}.ocean.t'+gcyc+'z.inst.f'+str(fcst_hr).zfill(3)+'.nc'))
files.append(os.path.join(bkg_path, f'{RUN}.ocean.t'+gcyc+'z.inst.f'+str(fcst_hr).zfill(3)+'.nc'))

# Identify the ocean background that will be used for the vertical coordinate remapping
ocn_filename_ic = os.path.splitext(os.path.basename(files[0]))[0]+'.nc'
Expand Down
Loading

0 comments on commit d18b322

Please sign in to comment.