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

make variables using filename_base consistant in length #43

Merged
merged 3 commits into from
Jan 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions fv3_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ module fv3gfs_cap_mod
cplprint_flag,output_1st_tstep_rst, &
first_kdt

use module_fv3_io_def, only: num_pes_fcst,write_groups, &
use module_fv3_io_def, only: max_filename_len, &
num_pes_fcst,write_groups, &
num_files, filename_base, &
wrttasks_per_group, n_group, &
lead_wrttask, last_wrttask, &
Expand Down Expand Up @@ -74,7 +75,7 @@ module fv3gfs_cap_mod

type(ESMF_GridComp) :: fcstComp
type(ESMF_State) :: fcstState
character(len=80), allocatable :: fcstItemNameList(:)
character(len=max_filename_len+14),allocatable :: fcstItemNameList(:)
Copy link
Collaborator

Choose a reason for hiding this comment

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

How is the "14" defined? This could be confusing and error-prone when the interpolation method is changed, such as "first_order_conservative". It seems a temporary fix, from that point of view, I would suggest just setting the length of all the character strings to "ESMF_MAXSTR". Not sure the reason to have the filenames exactly 255 characters. If we do want that, we need a different fix. Basically the filenames are the local file names, if developers want to write to a different directory, they can set that up in script level.

Copy link
Author

Choose a reason for hiding this comment

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

agreed and done.

type(ESMF_StateItem_Flag), allocatable :: fcstItemTypeList(:)
type(ESMF_FieldBundle), allocatable :: fcstFB(:)
integer, save :: FBCount
Expand Down
7 changes: 4 additions & 3 deletions io/module_fv3_io_def.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@ module module_fv3_io_def
!
implicit none
!
integer,parameter :: max_filename_len=255
integer :: num_pes_fcst
integer :: wrttasks_per_group, write_groups
integer :: n_group
logical :: write_nemsioflip
logical :: write_fsyncflag
integer :: num_files
character(255) :: output_grid
character(255) :: output_file
character(len=max_filename_len) :: output_grid
character(len=max_filename_len) :: output_file
integer :: imo,jmo
integer :: nbdlphys
integer :: nsout_io, iau_offset, ideflate, nbits
real :: cen_lon, cen_lat, lon1, lat1, lon2, lat2, dlon, dlat
real :: stdlat1, stdlat2, dx, dy
character(255),dimension(:),allocatable :: filename_base
character(len=max_filename_len),dimension(:),allocatable :: filename_base
!
integer,dimension(:),allocatable :: lead_wrttask, last_wrttask
!
Expand Down
9 changes: 5 additions & 4 deletions io/module_wrt_grid_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ module module_wrt_grid_comp
nsout => nsout_io, &
cen_lon, cen_lat, &
lon1, lat1, lon2, lat2, dlon, dlat, &
stdlat1, stdlat2, dx, dy, iau_offset
stdlat1, stdlat2, dx, dy, iau_offset, &
max_filename_len
use module_write_nemsio, only : nemsio_first_call, write_nemsio
use module_write_netcdf, only : write_netcdf
use physcons, only : pi => con_pi
Expand All @@ -56,7 +57,7 @@ module module_wrt_grid_comp
!
!-----------------------------------------------------------------------
!
integer,parameter :: filename_maxstr=255

real, parameter :: rdgas=287.04, grav=9.80
real, parameter :: stndrd_atmos_ps = 101325.
real, parameter :: stndrd_atmos_lapse = 0.0065
Expand All @@ -77,7 +78,7 @@ module module_wrt_grid_comp
type(wrt_internal_state),pointer :: wrt_int_state ! The internal state pointer.
type(ESMF_FieldBundle) :: gridFB
integer :: FBcount
character(len=80),allocatable :: fcstItemNameList(:)
character(len=max_filename_len+14),allocatable :: fcstItemNameList(:)
!
!-----------------------------------------------------------------------
REAL(KIND=8) :: btim,btim0
Expand Down Expand Up @@ -1155,7 +1156,7 @@ subroutine wrt_run(wrt_comp, imp_state_write, exp_state_write,clock,rc)
logical,save :: first=.true.
logical,save :: file_first=.true.
!
character(filename_maxstr) :: filename,compname,bundle_name
character(max_filename_len) :: filename,compname,bundle_name
character(40) :: cfhour, cform
character(10) :: stepString
character(80) :: attrValueS
Expand Down
5 changes: 3 additions & 2 deletions module_fcst_grid_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module module_fcst_grid_comp
use esmf
!
use module_fv3_io_def, only: num_pes_fcst, num_files, filename_base, nbdlphys, &
iau_offset
iau_offset, max_filename_len
use module_fv3_config, only: dt_atmos, calendar, restart_interval, &
quilting, calendar_type, cpl, &
cplprint_flag, force_date_from_configure
Expand Down Expand Up @@ -189,7 +189,8 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc)
character(3) cfhour
character(4) dateSY
character(2) dateSM,dateSD,dateSH,dateSN,dateSS
character(128) name_FB, name_FB1, dateS
character(len=max_filename_len+14) name_FB, name_FB1
character(len=80) :: dateS
real, allocatable, dimension(:,:) :: glon_bnd, glat_bnd

character(256) :: gridfile
Expand Down