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

Add atm_data_version to allow JRA55 forcing filenames to have a unique version string #876

Merged
merged 14 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
39 changes: 25 additions & 14 deletions cicecore/cicedyn/general/ice_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ module ice_forcing
atm_data_type, & ! 'default', 'monthly', 'ncar', 'box2001'
! 'hadgem', 'oned', 'calm', 'uniform'
! 'JRA55' or 'JRA55do'
atm_data_date, & ! date of atm_forcing file creation
bgc_data_type, & ! 'default', 'clim'
ocn_data_type, & ! 'default', 'clim', 'ncar', 'oned', 'calm', 'box2001'
! 'hadgem_sst' or 'hadgem_sst_uvocn', 'uniform'
Expand Down Expand Up @@ -2238,29 +2239,39 @@ subroutine JRA55_files(yr)
exists = .false.
cnt = 1
do while (.not.exists .and. cnt <= 6)
if (cnt == 1) uwind_file = trim(atm_data_dir)//'/'//trim(atm_data_type_prefix)// &
'/8XDAILY/'//trim(atm_data_type_prefix)//'_'//trim(grd)//'_03hr_forcing_2005.nc'

if (cnt == 2) uwind_file = trim(atm_data_dir)//'/'//trim(atm_data_type_prefix)// &
'/8XDAILY/'//trim(atm_data_type_prefix)//'_03hr_forcing_'//trim(grd)//'_2005.nc'
if (cnt == 1) uwind_file = trim(atm_data_dir)//'/'//trim(atm_data_type_prefix)// &
'/8XDAILY/'//trim(atm_data_type_prefix)//'_'//trim(grd)// &
'_03hr_forcing'//trim(atm_data_date)//'_2005.nc'

if (cnt == 3) uwind_file = trim(atm_data_dir)//'/'//trim(atm_data_type_prefix)// &
'/8XDAILY/'//trim(atm_data_type_prefix)// '_03hr_forcing_2005.nc'
if (cnt == 2) uwind_file = trim(atm_data_dir)//'/'//trim(atm_data_type_prefix)// &
'/8XDAILY/'//trim(atm_data_type_prefix)//'_03hr_forcing_'//trim(grd)// &
trim(atm_data_date)//'_2005.nc'

if (cnt == 4) uwind_file = trim(atm_data_dir)// &
'/8XDAILY/'//trim(atm_data_type_prefix)//'_'//trim(grd)//'_03hr_forcing_2005.nc'
if (cnt == 3) uwind_file = trim(atm_data_dir)//'/'//trim(atm_data_type_prefix)// &
'/8XDAILY/'//trim(atm_data_type_prefix)// &
'_03hr_forcing'//trim(atm_data_date)//'_2005.nc'

if (cnt == 4) uwind_file = trim(atm_data_dir)// &
'/8XDAILY/'//trim(atm_data_type_prefix)//'_'//trim(grd)// &
'_03hr_forcing'//trim(atm_data_date)//'_2005.nc'

if (cnt == 5) uwind_file = trim(atm_data_dir)// &
'/8XDAILY/'//trim(atm_data_type_prefix)//'_03hr_forcing_'//trim(grd)//'_2005.nc'
if (cnt == 5) uwind_file = trim(atm_data_dir)// &
'/8XDAILY/'//trim(atm_data_type_prefix)//'_03hr_forcing_'//trim(grd)// &
trim(atm_data_date)//'_2005.nc'

if (cnt == 6) uwind_file = trim(atm_data_dir)// &
'/8XDAILY/'//trim(atm_data_type_prefix)// '_03hr_forcing_2005.nc'
'/8XDAILY/'//trim(atm_data_type_prefix)// &
'_03hr_forcing'//trim(atm_data_date)//'_2005.nc'


call file_year(uwind_file,yr)
INQUIRE(FILE=uwind_file,EXIST=exists)
! if (my_task == master_task) then
! write(nu_diag,*) subname,cnt,exists,trim(uwind_file)
! endif

if (debug_forcing .and. (my_task == master_task)) then
write(nu_diag,*) subname,cnt,exists,trim(uwind_file)
apcraig marked this conversation as resolved.
Show resolved Hide resolved
endif

cnt = cnt + 1
enddo

Expand Down
8 changes: 6 additions & 2 deletions cicecore/cicedyn/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ subroutine input_data
use ice_forcing, only: &
ycycle, fyear_init, debug_forcing, &
atm_data_type, atm_data_dir, precip_units, rotate_wind, &
atm_data_format, ocn_data_format, &
atm_data_format, ocn_data_format, atm_data_date, &
bgc_data_type, &
ocn_data_type, ocn_data_dir, wave_spec_file, &
oceanmixed_file, restore_ocn, trestore, &
Expand Down Expand Up @@ -273,7 +273,7 @@ subroutine input_data
fyear_init, ycycle, wave_spec_file,restart_coszen, &
atm_data_dir, ocn_data_dir, bgc_data_dir, &
atm_data_format, ocn_data_format, rotate_wind, &
oceanmixed_file
oceanmixed_file, atm_data_date

!-----------------------------------------------------------------
! default values
Expand Down Expand Up @@ -498,6 +498,7 @@ subroutine input_data
atm_data_format = 'bin' ! file format ('bin'=binary or 'nc'=netcdf)
atm_data_type = 'default'
atm_data_dir = ' '
atm_data_date = '_undef' ! date atm_data_file was generated.
rotate_wind = .true. ! rotate wind/stress composants to computational grid orientation
calc_strair = .true. ! calculate wind stress
formdrag = .false. ! calculate form drag
Expand Down Expand Up @@ -1059,6 +1060,7 @@ subroutine input_data
call broadcast_scalar(atm_data_format, master_task)
call broadcast_scalar(atm_data_type, master_task)
call broadcast_scalar(atm_data_dir, master_task)
call broadcast_scalar(atm_data_date, master_task)
call broadcast_scalar(rotate_wind, master_task)
call broadcast_scalar(calc_strair, master_task)
call broadcast_scalar(calc_Tsfc, master_task)
Expand Down Expand Up @@ -2360,6 +2362,8 @@ subroutine input_data
write(nu_diag,1021) ' fyear_init = ', fyear_init
write(nu_diag,1021) ' ycycle = ', ycycle
write(nu_diag,1031) ' atm_data_type = ', trim(atm_data_type)
write(nu_diag,1031) ' atm_data_date = ', trim(atm_data_date)

if (trim(atm_data_type) /= 'default') then
write(nu_diag,1031) ' atm_data_dir = ', trim(atm_data_dir)
write(nu_diag,1031) ' precip_units = ', trim(precip_units)
Expand Down
1 change: 1 addition & 0 deletions configuration/scripts/ice_in
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
precip_units = 'mm_per_month'
default_season = 'winter'
atm_data_type = 'ncar'
atm_data_date = '_undef'
ocn_data_type = 'default'
bgc_data_type = 'default'
fe_data_type = 'default'
Expand Down
1 change: 1 addition & 0 deletions configuration/scripts/options/set_nml.gx1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ maskhalo_bound = .true.
fyear_init = 2005
atm_data_format = 'nc'
atm_data_type = 'JRA55'
atm_data_date = ''
atm_data_dir = 'ICE_MACHINE_INPUTDATA/CICE_data/forcing/gx1'
precip_units = 'mks'
ocn_data_dir = 'ICE_MACHINE_INPUTDATA/CICE_data/forcing/gx1/CESM/MONTHLY'
Expand Down
1 change: 1 addition & 0 deletions configuration/scripts/options/set_nml.gx3
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ bathymetry_file = 'ICE_MACHINE_INPUTDATA/CICE_data/grid/gx3/global_gx3.bathy.nc'
fyear_init = 2005
atm_data_format = 'nc'
atm_data_type = 'JRA55'
atm_data_date = ''
atm_data_dir = 'ICE_MACHINE_INPUTDATA/CICE_data/forcing/gx3'
precip_units = 'mks'
ocn_data_format = 'bin'
Expand Down
1 change: 1 addition & 0 deletions configuration/scripts/options/set_nml.jra55
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
atm_data_format = 'nc'
atm_data_type = 'JRA55'
daveh150 marked this conversation as resolved.
Show resolved Hide resolved
atm_data_date = '_20230919'
1 change: 1 addition & 0 deletions configuration/scripts/options/set_nml.jra55do
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
atm_data_format = 'nc'
atm_data_type = 'JRA55do'
atm_data_date = ''
1 change: 0 additions & 1 deletion configuration/scripts/options/set_nml.tx1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ grid_file = 'ICE_MACHINE_INPUTDATA/CICE_data/grid/tx1/grid_tx1.bin'
kmt_file = 'ICE_MACHINE_INPUTDATA/CICE_data/grid/tx1/kmt_tx1.bin'
atm_data_dir = 'ICE_MACHINE_INPUTDATA/CICE_data/forcing/tx1'
atm_data_format = 'nc'
atm_data_type = 'JRA55'
apcraig marked this conversation as resolved.
Show resolved Hide resolved
year_init = 2005
fyear_init = 2005
2 changes: 1 addition & 1 deletion configuration/scripts/tests/base_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ smoke gx3 4x2 diag1,run5day smoke_gx3_8x2_diag1_
smoke gx3 4x1 diag1,run5day,thread smoke_gx3_8x2_diag1_run5day
smoke gx3 1x8 diag1,run5day,evp1d
restart gx1 40x4 droundrobin,medium
restart tx1 40x4 dsectrobin,medium
restart tx1 40x4 dsectrobin,medium,jra55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

restart tx1 40x4 dsectrobin,medium,jra55do
restart gx3 4x4 none
restart gx3 10x4 maskhalo
Expand Down
4 changes: 3 additions & 1 deletion doc/source/developer_guide/dg_forcing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ use aspects of the following approach,
- Input files are organized by year. The underlying implementation provides for some flexibility and extensibility in filenames. For instance, JRA55 and JRA55do filenames can have syntax like ``[JRA55,JRA55do][_$grid,'']_03hr_forcing[_$grid,'']_$year.nc`` where $grid is optional or may be present at one of two locations within the filename. This implementation exists to support the current naming conventions within the gx1, gx3, and tx1 JRA55 and JRA55do CICE_DATA directory structure automatically. See **JRA55_files** in **ice_forcing.F90** for more details.
- Namelist inputs ``fyear`` and ``ycycle`` specify the forcing year dataset.
- The forcing year is computed on the fly and is assumed to be cyclical over the forcing dataset length defined by ``ycycle``.
- The namelist ``atm_data_dir`` specifies the path or partial path for the atmosphere input data files and the namelist ``atm_data_type`` defines the atmospheric forcing mode. ``atm_data_type`` values of ``JRA55``, ``JRA55do``, or ``ncar`` provide some flexibility for directory paths and filenames. Many details can be gleaned from the CICE_data directory structure and file names as well as from the implementation in **ice_forcing.F90**. But the main point is that atm_data_dir should be set to ${CICE_DATA_root}/forcing/$grid/[JRA55,JRA55do,NCAR_bulk,''] where [JRA55,JRA55do,NCAR_bulk] are optional but provided for backwards compatibility. grid is typically gx1, gx3, tx1, or similar.
- The namelist ``atm_data_dir`` specifies the path or partial path for
the atmosphere input data files and the namelist ``atm_data_type`` defines the atmospheric forcing mode. ``atm_data_type`` values of ``JRA55``, ``JRA55do``, or ``ncar`` provide some flexibility for directory paths and filenames. ``atm_data_date`` is a string in form ``_YYYYMMDD`` that
allows user to specify the creation date of the atm_forcing_file. Note the inclusion of the underscore in front of the date. Many details can be gleaned from the CICE_data directory structure and file names as well as from the implementation in **ice_forcing.F90**. But the main point is that atm_data_dir should be set to ${CICE_DATA_root}/forcing/$grid/[JRA55,JRA55do,NCAR_bulk,''] where [JRA55,JRA55do,NCAR_bulk] are optional but provided for backwards compatibility. grid is typically gx1, gx3, tx1, or similar.
- The namelist ``ocn_data_dir`` specifies the directory of the ocean input data files and the namelist ``ocn_data_type`` defines the ocean forcing mode.
- The filenames follow a particular naming convention that is defined in the source code (ie. subroutine **JRA55_files**). The forcing year is typically found just before the **.nc** part of the filename and there are tools (subroutine **file_year**) to update the filename based on the model year and appropriate forcing year.
- The input data time axis is generally NOT read by the forcing subroutine. The forcing frequency is hardwired into the model and the file record number is computed based on the forcing frequency and model time. Mixing leap year input data and noleap model calendars (and vice versa) is not handled particularly gracefully. The CICE model does not read or check against the input data time axis.
Expand Down
3 changes: 2 additions & 1 deletion doc/source/user_guide/ug_case_settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,8 @@ forcing_nml
"", "``constant``", "constant-based boundary layer", ""
"", "``mixed``", "stability-based boundary layer for wind stress, constant-based for sensible+latent heat fluxes", ""
"``atmiter_conv``", "real", "convergence criteria for ustar", "0.0"
"``atm_data_dir``", "string", "path or partial path to atmospheric forcing data directory", ""
"``atm_data_date``","string", "date of atm data forcing file creation", "``_undef``"
"``atm_data_dir``", "string", "path or partial path to atmosphericforcing data directory", ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this change intentional?

"``atm_data_format``", "``bin``", "read direct access binary atmo forcing file format", "``bin``"
"", "``nc``", "read netcdf atmo forcing files", ""
"``atm_data_type``", "``box2001``", "forcing data for :cite:`Hunke01` box problem", "``default``"
Expand Down
Loading