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

Addition of a switch for the cycling type #1072

Merged
merged 3 commits into from
Apr 25, 2024
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
9 changes: 7 additions & 2 deletions scripts/exgdas_global_marine_analysis_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def list_all_files(dir_in, dir_out, wc='*', fh_list=[]):
cyc = str(os.getenv('cyc')).zfill(2)
bcyc = str((int(cyc) - 3) % 24).zfill(2)
gcyc = str((int(cyc) - 6) % 24).zfill(2) # previous cycle
cdatedt = datetime.strptime(cdate, '%Y%m%d%H')
bdatedt = datetime.strptime(cdate, '%Y%m%d%H') - timedelta(hours=3)
bdate = datetime.strftime(bdatedt, '%Y-%m-%dT%H:00:00Z')
mdate = datetime.strftime(datetime.strptime(cdate, '%Y%m%d%H'), '%Y-%m-%dT%H:00:00Z')
Expand Down Expand Up @@ -93,8 +94,12 @@ def list_all_files(dir_in, dir_out, wc='*', fh_list=[]):
os.path.join(com_ocean_analysis, f'{RUN}.t{bcyc}z.ocngrid.nc')])

# Copy the CICE analysis restart
cdateice = pdy + '.' + cyc + '0000'
post_file_list.append([os.path.join(anl_dir, 'Data', f'{cdateice}.cice_model.res.nc'),
if os.getenv('DOIAU') == "YES":
cice_rst_date = bdatedt.strftime('%Y%m%d.%H%M%S')
else:
cice_rst_date = cdatedt.strftime('%Y%m%d.%H%M%S')

post_file_list.append([os.path.join(anl_dir, 'Data', f'{cice_rst_date}.cice_model.res.nc'),
os.path.join(com_ice_restart, f'{cdate}.cice_model_anl.res.nc')])

FileHandler({'copy': post_file_list}).sync()
Expand Down
19 changes: 14 additions & 5 deletions scripts/exgdas_global_marine_analysis_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ def find_clim_ens(input_date):
staticsoca_dir = os.getenv('SOCA_INPUT_FIX_DIR')
nmem_ens = 0
nmem_ens = int(os.getenv('NMEM_ENS'))
if os.getenv('DOHYBVAR') == "YES":
dohybvar = True
else:
dohybvar = False

# create analysis directories
diags = os.path.join(anl_dir, 'diags') # output dir for soca DA obs space
Expand All @@ -89,12 +85,25 @@ def find_clim_ens(input_date):
window_begin = datetime.strptime(os.getenv('PDY')+os.getenv('cyc'), '%Y%m%d%H') - half_assim_freq
window_begin_iso = window_begin.strftime('%Y-%m-%dT%H:%M:%SZ')
window_middle_iso = window_middle.strftime('%Y-%m-%dT%H:%M:%SZ')
fcst_begin = datetime.strptime(os.getenv('PDY')+os.getenv('cyc'), '%Y%m%d%H')
RUN = os.getenv('RUN')
cyc = os.getenv('cyc')
gcyc = os.getenv('gcyc')
PDY = os.getenv('PDY')

# hybrid-envar switch
if os.getenv('DOHYBVAR') == "YES":
dohybvar = True
else:
dohybvar = False

# switch for the cycling type
if os.getenv('DOIAU') == "YES":
# forecast initialized at the begining of the DA window
fcst_begin = window_begin
else:
# forecast initialized at the middle of the DA window
fcst_begin = datetime.strptime(os.getenv('PDY')+os.getenv('cyc'), '%Y%m%d%H')

################################################################################
# fetch observations

Expand Down
Loading