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

Enable relative path specification for IC files #273

Merged
merged 1 commit into from
Apr 4, 2024
Merged
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
30 changes: 24 additions & 6 deletions src/initialization/MOM_state_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,10 @@ subroutine initialize_thickness_from_file(h, depth_tot, G, GV, US, param_file, f
"The name of the thickness file.", &
fail_if_missing=.not.just_read, do_not_log=just_read)

filename = trim(inputdir)//trim(thickness_file)
filename = trim(thickness_file)
if (scan(thickness_file, "/") == 0) then ! prepend inputdir if only a filename is given
filename = trim(inputdir)//trim(thickness_file)
endif
if (.not.just_read) call log_param(param_file, mdl, "INPUTDIR/THICKNESS_FILE", filename)

if ((.not.just_read) .and. (.not.file_exists(filename, G%Domain))) call MOM_error(FATAL, &
Expand Down Expand Up @@ -1446,7 +1449,10 @@ subroutine initialize_velocity_from_file(u, v, G, GV, US, param_file, just_read)
call get_param(param_file, mdl, "INPUTDIR", inputdir, default=".")
inputdir = slasher(inputdir)

filename = trim(inputdir)//trim(velocity_file)
filename = trim(velocity_file)
if (scan(velocity_file, '/')== 0) then ! prepend inputdir if only a filename is given
filename = trim(inputdir)//trim(velocity_file)
endif
if (.not.just_read) call log_param(param_file, mdl, "INPUTDIR/VELOCITY_FILE", filename)

call get_param(param_file, mdl, "U_IC_VAR", u_IC_var, &
Expand Down Expand Up @@ -1627,7 +1633,10 @@ subroutine initialize_temp_salt_from_file(T, S, G, GV, US, param_file, just_read
call get_param(param_file, mdl, "INPUTDIR", inputdir, default=".")
inputdir = slasher(inputdir)

filename = trim(inputdir)//trim(ts_file)
filename = trim(ts_file)
if (scan(ts_file, '/')== 0) then ! prepend inputdir if only a filename is given
filename = trim(inputdir)//trim(ts_file)
endif
if (.not.just_read) call log_param(param_file, mdl, "INPUTDIR/TS_FILE", filename)
call get_param(param_file, mdl, "TEMP_IC_VAR", temp_var, &
"The initial condition variable for potential temperature.", &
Expand All @@ -1647,7 +1656,10 @@ subroutine initialize_temp_salt_from_file(T, S, G, GV, US, param_file, just_read
! Read the temperatures and salinities from netcdf files.
call MOM_read_data(filename, temp_var, T(:,:,:), G%Domain, scale=US%degC_to_C)

salt_filename = trim(inputdir)//trim(salt_file)
salt_filename = trim(salt_file)
if (scan(salt_file, '/')== 0) then ! prepend inputdir if only a filename is given
salt_filename = trim(inputdir)//trim(salt_file)
endif
if (.not.file_exists(salt_filename, G%Domain)) call MOM_error(FATAL, &
" initialize_temp_salt_from_file: Unable to open "//trim(salt_filename))

Expand Down Expand Up @@ -1977,7 +1989,10 @@ subroutine initialize_sponges_file(G, GV, US, use_temperature, tv, u, v, depth_t
default=.false.)

! Read in sponge damping rate for tracers
filename = trim(inputdir)//trim(damping_file)
filename = trim(damping_file)
if (scan(damping_file, '/')== 0) then ! prepend inputdir if only a filename is given
filename = trim(inputdir)//trim(damping_file)
endif
call log_param(param_file, mdl, "INPUTDIR/SPONGE_DAMPING_FILE", filename)
if (.not.file_exists(filename, G%Domain)) &
call MOM_error(FATAL, " initialize_sponges: Unable to open "//trim(filename))
Expand Down Expand Up @@ -2281,7 +2296,10 @@ subroutine initialize_oda_incupd_file(G, GV, US, use_temperature, tv, h, u, v, p
! call get_param(param_file, mdl, "USE_REGRIDDING", use_ALE, default=.false., do_not_log=.true.)

! Read in incremental update for tracers
filename = trim(inputdir)//trim(inc_file)
filename = trim(inc_file)
if (scan(inc_file, '/')== 0) then ! prepend inputdir if only a filename is given
filename = trim(inputdir)//trim(inc_file)
endif
call log_param(param_file, mdl, "INPUTDIR/ODA_INCUPD_FILE", filename)
if (.not.file_exists(filename, G%Domain)) &
call MOM_error(FATAL, " initialize_oda_incupd: Unable to open "//trim(filename))
Expand Down
Loading