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 consistent character lengths for files and paths #1567

Merged
merged 11 commits into from
Aug 5, 2024
6 changes: 3 additions & 3 deletions amip_interp/amip_interp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ module amip_interp_mod
NOTE, mpp_error, fms_error_handler

use constants_mod, only: TFREEZE, pi
use platform_mod, only: r4_kind, r8_kind, i2_kind
use platform_mod, only: r4_kind, r8_kind, i2_kind, FMS_FILE_LEN
use mpp_mod, only: input_nml_file
use fms2_io_mod, only: FmsNetcdfFile_t, fms2_io_file_exists=>file_exists, open_file, close_file, &
get_dimension_size, fms2_io_read_data=>read_data
use netcdf, only: NF90_MAX_NAME

implicit none
private
Expand Down Expand Up @@ -302,9 +303,8 @@ module amip_interp_mod

! ---- global unit & date ----

integer, parameter :: maxc = 128
integer :: iunit
character(len=maxc) :: file_name_sst, file_name_ice
character(len=FMS_FILE_LEN) :: file_name_sst, file_name_ice
type(FmsNetcdfFile_t), target :: fileobj_sst, fileobj_ice

type (date_type) :: Curr_date = date_type( -99, -99, -99 )
Expand Down
5 changes: 3 additions & 2 deletions amip_interp/include/amip_interp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ subroutine GET_AMIP_SST_ (Time, Interp, sst, err_msg, lon_model, lat_model)
integer, dimension(:), allocatable :: ryr, rmo, rdy
character(len=30) :: time_unit
real(FMS_AMIP_INTERP_KIND_), dimension(:), allocatable :: timeval
character(len=maxc) :: ncfilename
character(len=FMS_FILE_LEN) :: ncfilename
type(FmsNetcdfFile_t) :: fileobj
logical :: the_file_exists
! end add by JHC
Expand Down Expand Up @@ -652,7 +652,8 @@ endif
integer(I2_KIND) :: idat(mobs,nobs)
integer :: nrecords, yr, mo, dy, ierr, k
integer, dimension(:), allocatable :: ryr, rmo, rdy
character(len=maxc) :: ncfilename, ncfieldname
character(len=FMS_FILE_LEN) :: ncfilename
character(len=NF90_MAX_NAME) :: ncfieldname
type(FmsNetcdfFile_t), pointer :: fileobj
integer, parameter :: lkind = FMS_AMIP_INTERP_KIND_

Expand Down
2 changes: 1 addition & 1 deletion column_diagnostics/column_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module column_diagnostics_mod
get_date, time_type
use constants_mod, only: constants_init, PI, RADIAN
use mpp_mod, only: input_nml_file
use platform_mod, only: r4_kind, r8_kind
use platform_mod, only: r4_kind, r8_kind, FMS_FILE_LEN
!-------------------------------------------------------------------

implicit none
Expand Down
2 changes: 1 addition & 1 deletion column_diagnostics/include/column_diagnostics.inc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ integer, dimension(:), intent(out) :: diag_units !< unit number for
real(FMS_CD_KIND_) :: ref_lat
real(FMS_CD_KIND_) :: current_distance
character(len=8) :: char !< character string for diaganostic column index
character(len=32) :: filename !< filename for output file for diagnostic column
character(len=FMS_FILE_LEN) :: filename !< filename for output file for diagnostic column
logical :: allow_ij_input
logical :: open_file
integer :: io
Expand Down
8 changes: 4 additions & 4 deletions coupler/atmos_ocean_fluxes.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module atmos_ocean_fluxes_mod
use coupler_types_mod, only: ind_runoff
use coupler_types_mod, only: ind_flux, ind_deltap, ind_kw, ind_flux0

use field_manager_mod, only: fm_path_name_len, fm_string_len, fm_exists, fm_get_index
use field_manager_mod, only: fm_string_len, fm_exists, fm_get_index
use field_manager_mod, only: fm_new_list, fm_get_current_list, fm_change_list
use field_manager_mod, only: fm_field_name_len, fm_type_name_len, fm_dump_list
use field_manager_mod, only: fm_loop_over_list
Expand All @@ -63,7 +63,7 @@ module atmos_ocean_fluxes_mod
use fm_util_mod, only: fm_util_get_real_array, fm_util_get_real, fm_util_get_integer
use fm_util_mod, only: fm_util_get_logical, fm_util_get_logical_array
use fms_io_utils_mod, only: get_data_type_string
use platform_mod, only: r4_kind, r8_kind
use platform_mod, only: r4_kind, r8_kind, FMS_PATH_LEN

implicit none
private
Expand Down Expand Up @@ -135,8 +135,8 @@ function aof_set_coupler_flux(name, flux_type, implementation, atm_tr_index, par
integer :: length
integer :: num_parameters
integer :: outunit
character(len=fm_path_name_len) :: coupler_list
character(len=fm_path_name_len) :: current_list
character(len=FMS_PATH_LEN) :: coupler_list
character(len=FMS_PATH_LEN) :: current_list
character(len=fm_string_len) :: flux_type_test
character(len=fm_string_len) :: implementation_test
character(len=256) :: error_header
Expand Down
38 changes: 19 additions & 19 deletions coupler/coupler_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module coupler_types_mod
use mpp_domains_mod, only: domain2D, mpp_redistribute
use mpp_mod, only: mpp_error, FATAL, mpp_chksum
use fms_string_utils_mod, only: string
use platform_mod, only: r4_kind, r8_kind, i8_kind
use platform_mod, only: r4_kind, r8_kind, i8_kind, FMS_FILE_LEN, FMS_PATH_LEN

implicit none
private
Expand Down Expand Up @@ -103,8 +103,8 @@ module coupler_types_mod
character(len=128) :: implementation = ' ' !< implementation
logical, pointer, dimension(:) :: flag => NULL() !< flag
integer :: atm_tr_index = 0 !< atm_tr_index
character(len=128) :: ice_restart_file = ' ' !< ice_restart_file
character(len=128) :: ocean_restart_file = ' ' !< ocean_restart_file
character(len=FMS_FILE_LEN) :: ice_restart_file = ' ' !< ice_restart_file
character(len=FMS_FILE_LEN) :: ocean_restart_file = ' ' !< ocean_restart_file
#ifdef use_deprecated_io
type(restart_file_type), pointer :: rest_type => NULL() !< A pointer to the restart_file_type
!! that is used for this field.
Expand Down Expand Up @@ -146,8 +146,8 @@ module coupler_types_mod
character(len=128) :: implementation = ' ' !< implementation
logical, pointer, dimension(:) :: flag => NULL() !< flag
integer :: atm_tr_index = 0 !< atm_tr_index
character(len=128) :: ice_restart_file = ' ' !< ice_restart_file
character(len=128) :: ocean_restart_file = ' ' !< ocean_restart_file
character(len=FMS_FILE_LEN) :: ice_restart_file = ' ' !< ice_restart_file
character(len=FMS_FILE_LEN) :: ocean_restart_file = ' ' !< ocean_restart_file
#ifdef use_deprecated_io
type(restart_file_type), pointer :: rest_type => NULL() !< A pointer to the restart_file_type
!! that is used for this field.
Expand Down Expand Up @@ -207,8 +207,8 @@ module coupler_types_mod
real(r8_kind), pointer, dimension(:) :: param => NULL() !< param
logical, pointer, dimension(:) :: flag => NULL() !< flag
integer :: atm_tr_index = 0 !< atm_tr_index
character(len=128) :: ice_restart_file = ' ' !< ice_restart_file
character(len=128) :: ocean_restart_file = ' ' !< ocean_restart_file
character(len=FMS_FILE_LEN) :: ice_restart_file = ' ' !< ice_restart_file
character(len=FMS_FILE_LEN) :: ocean_restart_file = ' ' !< ocean_restart_file
#ifdef use_deprecated_io
type(restart_file_type), pointer :: rest_type => NULL() !< A pointer to the restart_file_type
!! that is used for this field.
Expand Down Expand Up @@ -253,8 +253,8 @@ module coupler_types_mod
real(r8_kind), pointer, dimension(:) :: param => NULL() !< param
logical, pointer, dimension(:) :: flag => NULL() !< flag
integer :: atm_tr_index = 0 !< atm_tr_index
character(len=124) :: ice_restart_file = ' ' !< ice_restart_file
character(len=124) :: ocean_restart_file = ' ' !< ocean_restart_file
character(len=FMS_FILE_LEN) :: ice_restart_file = ' ' !< ice_restart_file
character(len=FMS_FILE_LEN) :: ocean_restart_file = ' ' !< ocean_restart_file
#ifdef use_deprecated_io
type(restart_file_type), pointer :: rest_type => NULL() !< A pointer to the restart_file_type
!! that is used for this field.
Expand Down Expand Up @@ -309,8 +309,8 @@ module coupler_types_mod
real(r8_kind), pointer, dimension(:) :: param => NULL() !< param
logical, pointer, dimension(:) :: flag => NULL() !< flag
integer :: atm_tr_index = 0 !< atm_tr_index
character(len=128) :: ice_restart_file = ' ' !< ice_restart_file
character(len=128) :: ocean_restart_file = ' ' !< ocean_restart_file
character(len=FMS_FILE_LEN) :: ice_restart_file = ' ' !< ice_restart_file
character(len=FMS_FILE_LEN) :: ocean_restart_file = ' ' !< ocean_restart_file
logical :: use_atm_pressure !< use_atm_pressure
logical :: use_10m_wind_speed !< use_10m_wind_speed
logical :: pass_through_ice !< pass_through_ice
Expand Down Expand Up @@ -350,8 +350,8 @@ module coupler_types_mod
real(r8_kind), pointer, dimension(:) :: param => NULL() !< param
logical, pointer, dimension(:) :: flag => NULL() !< flag
integer :: atm_tr_index = 0 !< atm_tr_index
character(len=128) :: ice_restart_file = ' ' !< ice_restart_file
character(len=128) :: ocean_restart_file = ' ' !< ocean_restart_file
character(len=FMS_FILE_LEN) :: ice_restart_file = ' ' !< ice_restart_file
character(len=FMS_FILE_LEN) :: ocean_restart_file = ' ' !< ocean_restart_file
logical :: use_atm_pressure !< use_atm_pressure
logical :: use_10m_wind_speed !< use_10m_wind_speed
logical :: pass_through_ice !< pass_through_ice
Expand Down Expand Up @@ -3076,15 +3076,15 @@ subroutine CT_register_restarts_2d(var, bc_rest_files, num_rest_files, mpp_domai
logical, optional,intent(in) :: ocean_restart !< If true, use the ocean restart file name.
character(len=*),optional,intent(in) :: directory !< Directory where to open the file

character(len=80), dimension(max(1,var%num_bcs)) :: rest_file_names
character(len=80) :: file_nm
character(len=FMS_FILE_LEN), dimension(max(1,var%num_bcs)) :: rest_file_names
character(len=FMS_FILE_LEN) :: file_nm
logical :: ocn_rest
integer :: f, n, m

character(len=20), allocatable, dimension(:) :: dim_names !< Array of dimension names
character(len=20) :: io_type !< flag indicating io type: "read" "overwrite"
logical, dimension(max(1,var%num_bcs)) :: file_is_open !< flag indicating if file is open
character(len=20) :: dir !< Directory where to open the file
character(len=FMS_PATH_LEN) :: dir !< Directory where to open the file

if(var%set .and. var%num_bcs .gt. 0) then
if(associated(var%bc) .eqv. associated(var%bc_r4)) then
Expand Down Expand Up @@ -3358,15 +3358,15 @@ subroutine CT_register_restarts_3d(var, bc_rest_files, num_rest_files, mpp_domai
logical, optional,intent(in) :: ocean_restart !< If true, use the ocean restart file name.
character(len=*),optional,intent(in) :: directory !< Directory where to open the file

character(len=80), dimension(max(1,var%num_bcs)) :: rest_file_names
character(len=80) :: file_nm
character(len=FMS_FILE_LEN), dimension(max(1,var%num_bcs)) :: rest_file_names
character(len=FMS_FILE_LEN) :: file_nm
logical :: ocn_rest
integer :: f, n, m

character(len=20), allocatable, dimension(:) :: dim_names !< Array of dimension names
character(len=20) :: io_type !< flag indicating io type: "read" "overwrite"
logical, dimension(max(1,var%num_bcs)) :: file_is_open !< Flag indicating if file is open
character(len=20) :: dir !< Directory where to open the file
character(len=FMS_PATH_LEN) :: dir !< Directory where to open the file
integer :: nz !< Length of the z direction of each file

if(var%set .and. var%num_bcs .gt. 0) then
Expand Down
2 changes: 1 addition & 1 deletion data_override/get_grid_version.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
!> @{
module get_grid_version_mod
use constants_mod, only: DEG_TO_RAD
use platform_mod, only: r4_kind, r8_kind
use platform_mod, only: r4_kind, r8_kind, FMS_PATH_LEN
use mpp_mod, only : mpp_error,FATAL,NOTE, mpp_min, mpp_max
use mpp_domains_mod, only : domain2d, operator(.NE.),operator(.EQ.)
use mpp_domains_mod, only : mpp_get_global_domain, mpp_get_data_domain
Expand Down
28 changes: 14 additions & 14 deletions data_override/include/data_override.inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
! modules. These modules are not intended to be used directly - they should be
! used through the data_override_mod API. See data_override.F90 for details.

use platform_mod, only: r4_kind, r8_kind
use platform_mod, only: r4_kind, r8_kind, FMS_PATH_LEN
use yaml_parser_mod
use constants_mod, only: DEG_TO_RAD
use mpp_mod, only : mpp_error, FATAL, WARNING, NOTE, stdout, stdlog, mpp_max
Expand Down Expand Up @@ -61,14 +61,14 @@ type data_type
character(len=3) :: gridname
character(len=128) :: fieldname_code !< fieldname used in user's code (model)
character(len=128) :: fieldname_file !< fieldname used in the netcdf data file
character(len=512) :: file_name !< name of netCDF data file
character(len=FMS_PATH_LEN) :: file_name !< name of netCDF data file
character(len=128) :: interpol_method !< interpolation method (default "bilinear")
real(FMS_DATA_OVERRIDE_KIND_) :: factor !< For unit conversion, default=1, see OVERVIEW above
real(FMS_DATA_OVERRIDE_KIND_) :: lon_start, lon_end, lat_start, lat_end
integer :: region_type
logical :: multifile = .false.
character(len=512) :: prev_file_name !< name of netCDF data file for previous segment
character(len=512) :: next_file_name !< name of netCDF data file for next segment
character(len=FMS_PATH_LEN) :: prev_file_name !< name of netCDF data file for previous segment
character(len=FMS_PATH_LEN) :: next_file_name !< name of netCDF data file for next segment
type(time_type), dimension(:), allocatable :: time_records
type(time_type), dimension(:), allocatable :: time_prev_records
type(time_type), dimension(:), allocatable :: time_next_records
Expand Down Expand Up @@ -152,7 +152,7 @@ subroutine DATA_OVERRIDE_INIT_IMPL_(Atm_domain_in, Ocean_domain_in, Ice_domain_i
type (domain2d), intent(in), optional :: Land_domain_in !> Land domain
type(domainUG) , intent(in), optional :: Land_domainUG_in !> Land domain, unstructured grid

character(len=128) :: grid_file = 'INPUT/grid_spec.nc'
character(len=18), parameter :: grid_file = 'INPUT/grid_spec.nc'
integer :: is,ie,js,je,use_get_grid_version
integer :: i, iunit, io_status, ierr
logical :: atm_on, ocn_on, lnd_on, ice_on, lndUG_on
Expand Down Expand Up @@ -786,9 +786,9 @@ subroutine DATA_OVERRIDE_0D_(gridname,fieldname_code,data_out,time,override,data

type(time_type) :: first_record !< first record of "current" file
type(time_type) :: last_record !< last record of "current" file
character(len=512) :: filename !< file containing source data
character(len=512) :: prevfilename !< file containing previous source data, when using multiple files
character(len=512) :: nextfilename !< file containing next source data, when using multiple files
character(len=FMS_PATH_LEN) :: filename !< file containing source data
character(len=FMS_PATH_LEN) :: prevfilename !< file containing previous source data, when using multiple files
character(len=FMS_PATH_LEN) :: nextfilename !< file containing next source data, when using multiple files
character(len=128) :: fieldname !< fieldname used in the data file
integer :: index1 !< field index in data_table
integer :: dims(4)
Expand Down Expand Up @@ -980,12 +980,12 @@ subroutine DATA_OVERRIDE_3D_(gridname,fieldname_code,return_data,time,override,d
integer, optional, intent(in) :: is_in, ie_in, js_in, je_in
logical, dimension(:,:,:), allocatable :: mask_out

character(len=512) :: filename !< file containing source data
character(len=512) :: filename2 !< file containing source data
character(len=512) :: prevfilename !< file containing source data for previous file
character(len=512) :: prevfilename2 !< file containing source data for previous file
character(len=512) :: nextfilename !< file containing source data for next file
character(len=512) :: nextfilename2 !< file containing source data for next file
character(len=FMS_PATH_LEN) :: filename !< file containing source data
character(len=FMS_PATH_LEN) :: filename2 !< file containing source data
character(len=FMS_PATH_LEN) :: prevfilename !< file containing source data for previous file
character(len=FMS_PATH_LEN) :: prevfilename2 !< file containing source data for previous file
character(len=FMS_PATH_LEN) :: nextfilename !< file containing source data for next file
character(len=FMS_PATH_LEN) :: nextfilename2 !< file containing source data for next file
character(len=128) :: fieldname !< fieldname used in the data file
integer :: i,j
integer :: dims(4)
Expand Down
2 changes: 1 addition & 1 deletion data_override/include/get_grid_version.inc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ subroutine GET_GRID_VERSION_2_(fileobj, mod_name, domain, isc, iec, jsc, jec, lo
integer :: isd, ied, jsd, jed
integer :: isg, ieg, jsg, jeg
integer :: isc2, iec2, jsc2, jec2
character(len=256) :: solo_mosaic_file, grid_file
character(len=FMS_PATH_LEN) :: solo_mosaic_file, grid_file
real(lkind), allocatable :: tmpx(:,:), tmpy(:,:)
logical :: open_solo_mosaic
type(FmsNetcdfFile_t) :: mosaicfileobj, tilefileobj
Expand Down
Loading
Loading