Skip to content

Commit

Permalink
update path lengths in fms2_io
Browse files Browse the repository at this point in the history
  • Loading branch information
rem1776 authored and rem1776 committed Aug 1, 2024
1 parent 13b068d commit c7caaf8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
14 changes: 7 additions & 7 deletions fms2_io/blackboxio.F90
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ subroutine get_new_filename(path, new_path, directory, timestamp, new_name)
character(len=*), intent(in), optional :: timestamp !< Time.
character(len=*), intent(in), optional :: new_name !< New file basename.

character(len=256) :: dir
character(len=256) :: tstamp
character(len=256) :: nname
character(len=FMS_PATH_LEN) :: dir
character(len=FMS_FILE_LEN) :: tstamp
character(len=FMS_FILE_LEN) :: nname

dir = ""
if (present(directory)) then
Expand Down Expand Up @@ -392,7 +392,7 @@ subroutine netcdf_save_restart_wrap2(fileobj, unlim_dim_level, directory, timest
!! or "netcdf4". Defaults to
!! "64bit".

character(len=256) :: new_name
character(len=FMS_PATH_LEN) :: new_name
type(FmsNetcdfFile_t), target :: new_fileobj
type(FmsNetcdfFile_t), pointer :: p
logical :: close_new_file
Expand Down Expand Up @@ -425,7 +425,7 @@ subroutine netcdf_restore_state_wrap(fileobj, unlim_dim_level, directory, timest
character(len=*), intent(in), optional :: timestamp !< Model time.
character(len=*), intent(in), optional :: filename !< New name for the file.

character(len=256) :: new_name
character(len=FMS_PATH_LEN) :: new_name
type(FmsNetcdfFile_t), target :: new_fileobj
type(FmsNetcdfFile_t), pointer :: p
logical :: close_new_file
Expand Down Expand Up @@ -534,7 +534,7 @@ subroutine save_domain_restart_wrap(fileobj, unlim_dim_level, directory, timesta
!! or "netcdf4". Defaults to
!! "64bit".

character(len=256) :: new_name
character(len=FMS_PATH_LEN) :: new_name
type(FmsNetcdfDomainFile_t), target :: new_fileobj
type(FmsNetcdfDomainFile_t), pointer :: p
logical :: close_new_file
Expand Down Expand Up @@ -567,7 +567,7 @@ subroutine restore_domain_state_wrap(fileobj, unlim_dim_level, directory, timest
character(len=*), intent(in), optional :: filename !< New name for the file.
logical, intent(in), optional :: ignore_checksum !< Checksum data integrity flag.

character(len=256) :: new_name
character(len=FMS_PATH_LEN) :: new_name
type(FmsNetcdfDomainFile_t), target :: new_fileobj
type(FmsNetcdfDomainFile_t), pointer :: p
logical :: close_new_file
Expand Down
6 changes: 4 additions & 2 deletions fms2_io/fms_io_utils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ subroutine get_mosaic_tile_file_sg(file_in, file_out, is_no_domain, domain, tile
type(domain2D), intent(in), optional, target :: domain !< domain provided
integer, intent(in), optional :: tile_count !< tile count

character(len=256) :: basefile, tilename
character(len=FMS_PATH_LEN) :: basefile
character(len=6) :: tilename
character(len=2) :: my_tile_str
integer :: lens, ntiles, ntileMe, tile, my_tile_id
integer, dimension(:), allocatable :: tile_id
Expand Down Expand Up @@ -735,7 +736,8 @@ subroutine get_mosaic_tile_file_ug(file_in, file_out, domain)
character(len=*), intent(out) :: file_out !< name of tile file
type(domainUG), intent(in), optional :: domain !< domain provided

character(len=256) :: basefile, tilename
character(len=FMS_PATH_LEN) :: basefile
character(len=6) :: tilename
character(len=2) :: my_tile_str
integer :: lens, ntiles, my_tile_id

Expand Down
6 changes: 3 additions & 3 deletions fms2_io/fms_netcdf_domain_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module fms_netcdf_domain_io_mod
!! with the "y" axis
!! of a 2d domain.
integer :: ny !< Number of "y" dimensions.
character(len=256) :: non_mangled_path !< Non-domain-mangled file path.
character(len=FMS_PATH_LEN) :: non_mangled_path !< Non-domain-mangled file path.
logical :: adjust_indices !< Flag telling if indices need to be adjusted
!! for domain-decomposed read.
endtype FmsNetcdfDomainFile_t
Expand Down Expand Up @@ -346,9 +346,9 @@ function open_domain_file(fileobj, path, mode, domain, nc_format, is_restart, do

integer, dimension(2) :: io_layout
integer, dimension(1) :: tile_id
character(len=256) :: combined_filepath
character(len=FMS_PATH_LEN) :: combined_filepath
type(domain2d), pointer :: io_domain
character(len=256) :: distributed_filepath
character(len=FMS_PATH_LEN) :: distributed_filepath
integer :: pelist_size
integer, dimension(:), allocatable :: pelist
logical :: success2
Expand Down
7 changes: 4 additions & 3 deletions fms2_io/fms_netcdf_unstructured_domain_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ module fms_netcdf_unstructured_domain_io_mod
use mpp_domains_mod
use fms_io_utils_mod
use netcdf_io_mod
use platform_mod
implicit none
private

!> @brief netcdf unstructured domain file type.
!> @ingroup fms_netcdf_unstructured_domain_io_mod
type, public, extends(FmsNetcdfFile_t) :: FmsNetcdfUnstructuredDomainFile_t
type(domainug) :: domain !< Unstructured domain.
character(len=256) :: non_mangled_path !< Non-domain-mangled path.
character(len=FMS_PATH_LEN) :: non_mangled_path !< Non-domain-mangled path.
endtype FmsNetcdfUnstructuredDomainFile_t

!> @addtogroup fms_netcdf_unstructured_domain_io_mod
Expand Down Expand Up @@ -94,8 +95,8 @@ function open_unstructured_domain_file(fileobj, path, mode, domain, nc_format, &
type(domainug), pointer :: io_domain
integer :: pelist_size
integer, dimension(:), allocatable :: pelist
character(len=256) :: buf
character(len=256) :: buf2
character(len=FMS_PATH_LEN) :: buf
character(len=FMS_PATH_LEN) :: buf2
integer :: tile_id

!Get the input domain's I/O domain pelist.
Expand Down
6 changes: 3 additions & 3 deletions fms2_io/netcdf_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ module netcdf_io_mod
!> @brief Netcdf file type.
!> @ingroup netcdf_io_mod
type, public :: FmsNetcdfFile_t
character(len=256) :: path !< File path.
character(len=FMS_PATH_LEN) :: path !< File path.
logical :: is_readonly !< Flag telling if the file is readonly.
integer :: ncid !< Netcdf file id.
character(len=256) :: nc_format !< Netcdf file format.
Expand Down Expand Up @@ -569,8 +569,8 @@ function netcdf_file_open(fileobj, path, mode, nc_format, pelist, is_restart, do
integer :: err
integer :: netcdf4 !< Query the file for the _IsNetcdf4 global attribute in the event
!! that the open for collective reads fails
character(len=256) :: buf !< Filename with .res in the filename if it is a restart
character(len=256) :: buf2 !< Filename with the filename appendix if there is one
character(len=FMS_PATH_LEN) :: buf !< File path with .res in the filename if it is a restart
character(len=FMS_PATH_LEN) :: buf2 !< File path with the filename appendix if there is one
logical :: is_res
logical :: dont_add_res !< flag indicated to not add ".res" to the filename

Expand Down

0 comments on commit c7caaf8

Please sign in to comment.