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

Makes MAX_FIELDS_PER_FILE a namelist variable and allocates #750

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
9 changes: 3 additions & 6 deletions diag_manager/diag_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ MODULE diag_data_mod


! <!-- PARAMETERS for diag_data.F90 -->
! <DATA NAME="MAX_FIELDS_PER_FILE" TYPE="INTEGER, PARAMETER" DEFAULT="300">
! Maximum number of fields per file.
! </DATA>
! <DATA NAME="DIAG_OTHER" TYPE="INTEGER, PARAMETER" DEFAULT="0" />
! <DATA NAME="DIAG_OCEAN" TYPE="INTEGER, PARAMETER" DEFAULT="1" />
! <DATA NAME="DIAG_ALL" TYPE="INTEGER, PARAMETER" DEFAULT="2" />
Expand All @@ -121,7 +118,6 @@ MODULE diag_data_mod
! Return value for a diag_field that isn't found in the diag_table
! </DATA>
! Specify storage limits for fixed size tables used for pointers, etc.
INTEGER, PARAMETER :: MAX_FIELDS_PER_FILE = 300 !< Maximum number of fields per file.
INTEGER, PARAMETER :: DIAG_OTHER = 0
INTEGER, PARAMETER :: DIAG_OCEAN = 1
INTEGER, PARAMETER :: DIAG_ALL = 2
Expand Down Expand Up @@ -183,7 +179,7 @@ MODULE diag_data_mod
TYPE file_type
CHARACTER(len=128) :: name !< Name of the output file.
CHARACTER(len=128) :: long_name
INTEGER, DIMENSION(max_fields_per_file) :: fields
INTEGER, allocatable, DIMENSION(:) :: fields
INTEGER :: num_fields
INTEGER :: output_freq
INTEGER :: output_units
Expand Down Expand Up @@ -410,6 +406,7 @@ MODULE diag_data_mod
! Will determine which value to use when checking a regional output if the region is the full axis or a sub-axis.
! The values are defined as <TT>GLO_REG_VAL</TT> (-999) and <TT>GLO_REG_VAL_ALT</TT> (-1) in <TT>diag_data_mod</TT>.
! </DATA>
!> MAX_FIELDS_PER_FILE default = 300 Maximum number of fields per file.
LOGICAL :: append_pelist_name = .FALSE.
LOGICAL :: mix_snapshot_average_fields =.FALSE.
INTEGER :: max_files = 31 !< Maximum number of output files allowed. Increase via diag_manager_nml.
Expand Down Expand Up @@ -442,7 +439,7 @@ MODULE diag_data_mod
INTEGER :: max_axis_attributes = 4 !< Maximum number of user definable attributes per axis.
LOGICAL :: prepend_date = .TRUE. !< Should the history file have the start date prepended to the file name
LOGICAL :: use_mpp_io = .false. !< false is fms2_io (default); true is mpp_io

INTEGER :: MAX_FIELDS_PER_FILE = 300 !< Maximum number of fields per file.
! <!-- netCDF variable -->
! <DATA NAME="FILL_VALUE" TYPE="REAL" DEFAULT="NF90_FILL_REAL">
! Fill value used. Value will be <TT>NF90_FILL_REAL</TT> if using the
Expand Down
2 changes: 2 additions & 0 deletions diag_manager/diag_util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,8 @@ SUBROUTINE init_output_field(module_name, field_name, output_name, output_file,&
! </ERROR>
CALL error_mesg('diag_util_mod::init_output_field',&
& 'MAX_FIELDS_PER_FILE = '//TRIM(error_msg)//' exceeded. Increase MAX_FIELDS_PER_FILE in diag_data.F90.', FATAL)
ELSEIF (.not. allocated(files(file_num)%fields)) THEN
allocate(files(file_num)%fields(MAX_FIELDS_PER_FILE))
END IF
num_fields = files(file_num)%num_fields
files(file_num)%fields(num_fields) = out_num
Expand Down