Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into horvisc_diag_to_stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Hallberg-NOAA authored Apr 1, 2021
2 parents 2ffea27 + 6d4a483 commit 665cd9a
Show file tree
Hide file tree
Showing 14 changed files with 1,099 additions and 2,836 deletions.
13 changes: 11 additions & 2 deletions config_src/infra/FMS1/MOM_interp_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ module MOM_interp_infra
! This file is part of MOM6. See LICENSE.md for the license.

use MOM_domain_infra, only : MOM_domain_type, domain2d
use MOM_io_infra, only : axistype
use MOM_time_manager, only : time_type
use horiz_interp_mod, only : horiz_interp_new, horiz_interp, horiz_interp_init, horiz_interp_type
use mpp_io_mod, only : axistype, mpp_get_axis_data
use time_interp_external_mod, only : time_interp_external
use time_interp_external_mod, only : init_external_field, time_interp_external_init
use time_interp_external_mod, only : get_external_field_size
Expand All @@ -16,7 +16,7 @@ module MOM_interp_infra

public :: horiz_interp_type, horiz_interp_init
public :: time_interp_extern, init_extern_field, time_interp_external_init
public :: get_external_field_info
public :: get_external_field_info, axistype, get_axis_data
public :: run_horiz_interp, build_horiz_interp_weights

!> Read a field based on model time, and rotate to the model domain.
Expand Down Expand Up @@ -114,6 +114,15 @@ subroutine build_horiz_interp_weights_2d_to_2d(Interp, lon_in, lat_in, lon_out,
end subroutine build_horiz_interp_weights_2d_to_2d


!> Extracts and returns the axis data stored in an axistype.
subroutine get_axis_data( axis, dat )
type(axistype), intent(in) :: axis !< An axis type
real, dimension(:), intent(out) :: dat !< The data in the axis variable

call mpp_get_axis_data( axis, dat )
end subroutine get_axis_data


!> get size of an external field from field index
function get_extern_field_size(index)

Expand Down
33 changes: 14 additions & 19 deletions config_src/infra/FMS1/MOM_io_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,12 @@ subroutine get_filename_suffix(suffix)
end subroutine get_filename_suffix


!> Get information about the number of dimensions, variables, global attributes and time levels
!> Get information about the number of dimensions, variables and time levels
!! in the file associated with an open file unit
subroutine get_file_info(IO_handle, ndim, nvar, natt, ntime)
subroutine get_file_info(IO_handle, ndim, nvar, ntime)
type(file_type), intent(in) :: IO_handle !< Handle for a file that is open for I/O
integer, optional, intent(out) :: ndim !< The number of dimensions in the file
integer, optional, intent(out) :: nvar !< The number of variables in the file
integer, optional, intent(out) :: natt !< The number of global attributes in the file
integer, optional, intent(out) :: ntime !< The number of time levels in the file

! Local variables
Expand All @@ -328,7 +327,6 @@ subroutine get_file_info(IO_handle, ndim, nvar, natt, ntime)

if (present(ndim)) ndim = ndims
if (present(nvar)) nvar = nvars
if (present(natt)) natt = natts
if (present(ntime)) ntime = ntimes

end subroutine get_file_info
Expand Down Expand Up @@ -683,7 +681,7 @@ subroutine write_field_4d(IO_handle, field_md, MOM_domain, field, tstamp, tile_c
type(fieldtype), intent(in) :: field_md !< Field type with metadata
type(MOM_domain_type), intent(in) :: MOM_domain !< The MOM_Domain that describes the decomposition
real, dimension(:,:,:,:), intent(inout) :: field !< Field to write
real, optional, intent(in) :: tstamp !< Model timestamp
real, optional, intent(in) :: tstamp !< Model time of this field
integer, optional, intent(in) :: tile_count !< PEs per tile (default: 1)
real, optional, intent(in) :: fill_value !< Missing data fill value

Expand All @@ -697,7 +695,7 @@ subroutine write_field_3d(IO_handle, field_md, MOM_domain, field, tstamp, tile_c
type(fieldtype), intent(in) :: field_md !< Field type with metadata
type(MOM_domain_type), intent(in) :: MOM_domain !< The MOM_Domain that describes the decomposition
real, dimension(:,:,:), intent(inout) :: field !< Field to write
real, optional, intent(in) :: tstamp !< Model timestamp
real, optional, intent(in) :: tstamp !< Model time of this field
integer, optional, intent(in) :: tile_count !< PEs per tile (default: 1)
real, optional, intent(in) :: fill_value !< Missing data fill value

Expand All @@ -711,7 +709,7 @@ subroutine write_field_2d(IO_handle, field_md, MOM_domain, field, tstamp, tile_c
type(fieldtype), intent(in) :: field_md !< Field type with metadata
type(MOM_domain_type), intent(in) :: MOM_domain !< The MOM_Domain that describes the decomposition
real, dimension(:,:), intent(inout) :: field !< Field to write
real, optional, intent(in) :: tstamp !< Model timestamp
real, optional, intent(in) :: tstamp !< Model time of this field
integer, optional, intent(in) :: tile_count !< PEs per tile (default: 1)
real, optional, intent(in) :: fill_value !< Missing data fill value

Expand All @@ -724,7 +722,7 @@ subroutine write_field_1d(IO_handle, field_md, field, tstamp)
type(file_type), intent(in) :: IO_handle !< Handle for a file that is open for writing
type(fieldtype), intent(in) :: field_md !< Field type with metadata
real, dimension(:), intent(in) :: field !< Field to write
real, optional, intent(in) :: tstamp !< Model timestamp
real, optional, intent(in) :: tstamp !< Model time of this field

call mpp_write(IO_handle%unit, field_md, field, tstamp=tstamp)
end subroutine write_field_1d
Expand All @@ -734,7 +732,7 @@ subroutine write_field_0d(IO_handle, field_md, field, tstamp)
type(file_type), intent(in) :: IO_handle !< Handle for a file that is open for writing
type(fieldtype), intent(in) :: field_md !< Field type with metadata
real, intent(in) :: field !< Field to write
real, optional, intent(in) :: tstamp !< Model timestamp
real, optional, intent(in) :: tstamp !< Model time of this field

call mpp_write(IO_handle%unit, field_md, field, tstamp=tstamp)
end subroutine write_field_0d
Expand All @@ -750,7 +748,8 @@ end subroutine MOM_write_axis

!> Store information about an axis in a previously defined axistype and write this
!! information to the file indicated by unit.
subroutine write_metadata_axis(IO_handle, axis, name, units, longname, cartesian, sense, domain, data, calendar)
subroutine write_metadata_axis(IO_handle, axis, name, units, longname, cartesian, sense, domain, &
data, edge_axis, calendar)
type(file_type), intent(in) :: IO_handle !< Handle for a file that is open for writing
type(axistype), intent(inout) :: axis !< The axistype where this information is stored.
character(len=*), intent(in) :: name !< The name in the file of this axis
Expand All @@ -763,6 +762,7 @@ subroutine write_metadata_axis(IO_handle, axis, name, units, longname, cartesian
!! -1 if they increase downward.
type(domain1D), optional, intent(in) :: domain !< The domain decomposion for this axis
real, dimension(:), optional, intent(in) :: data !< The coordinate values of the points on this axis
logical, optional, intent(in) :: edge_axis !< If true, this axis marks an edge of the tracer cells
character(len=*), optional, intent(in) :: calendar !< The name of the calendar used with a time axis

call mpp_write_meta(IO_handle%unit, axis, name, units, longname, cartesian=cartesian, sense=sense, &
Expand All @@ -772,19 +772,13 @@ end subroutine write_metadata_axis
!> Store information about an output variable in a previously defined fieldtype and write this
!! information to the file indicated by unit.
subroutine write_metadata_field(IO_handle, field, axes, name, units, longname, &
min, max, fill, scale, add, pack, standard_name, checksum)
pack, standard_name, checksum)
type(file_type), intent(in) :: IO_handle !< Handle for a file that is open for writing
type(fieldtype), intent(inout) :: field !< The fieldtype where this information is stored
type(axistype), dimension(:), intent(in) :: axes !< Handles for the axis used for this variable
character(len=*), intent(in) :: name !< The name in the file of this variable
character(len=*), intent(in) :: units !< The units of this variable
character(len=*), intent(in) :: longname !< The long description of this variable
real, optional, intent(in) :: min !< The minimum valid value for this variable
real, optional, intent(in) :: max !< The maximum valid value for this variable
real, optional, intent(in) :: fill !< Missing data fill value
real, optional, intent(in) :: scale !< An multiplicative factor by which to scale
!! the variable before output
real, optional, intent(in) :: add !< An offset to add to the variable before output
integer, optional, intent(in) :: pack !< A precision reduction factor with which the
!! variable. The default, 1, has no reduction,
!! but 2 is not uncommon.
Expand All @@ -793,8 +787,9 @@ subroutine write_metadata_field(IO_handle, field, axes, name, units, longname, &
optional, intent(in) :: checksum !< Checksum values that can be used to verify reads.


call mpp_write_meta(IO_handle%unit, field, axes, name, units, longname, min=min, max=max, &
fill=fill, scale=scale, add=add, pack=pack, standard_name=standard_name, checksum=checksum)
call mpp_write_meta(IO_handle%unit, field, axes, name, units, longname, &
pack=pack, standard_name=standard_name, checksum=checksum)
! unused opt. args: min=min, max=max, fill=fill, scale=scale, add=add, &

end subroutine write_metadata_field

Expand Down
Loading

0 comments on commit 665cd9a

Please sign in to comment.