ocnice_prep 1.14.0
Loading...
Searching...
No Matches
utils_mod.F90 File Reference

Define utility procedures. More...

Go to the source code of this file.

Data Types

interface  utils_mod::dumpnc
 
interface  utils_mod::getfield
 
interface  utils_mod::getvecpair
 
interface  utils_mod::packarrays
 
interface  utils_mod::remap
 

Functions/Subroutines

subroutine utils_mod::dumpnc1d (fname, vname, dims, field)
 Write a bare netcdf file of a unpacked 2D field.
 
subroutine utils_mod::dumpnc2d (fname, vname, dims, nflds, field)
 Write a bare netcdf file of a 2D packed field.
 
subroutine utils_mod::dumpnc3d (fname, vname, dims, nk, nflds, field)
 Write a bare netcdf file of a packed 3D field.
 
subroutine utils_mod::dumpnc3dk (fname, vname, dims, field)
 Write a bare netcdf file of an unpacked 3D field.
 
subroutine utils_mod::getfield2d (fname, vname, dims, field, wgts)
 Obtain a 2D field and return a 1-D vector array.
 
subroutine utils_mod::getfield3d (fname, vname, dims, field, wgts)
 Obtain a 3D field and return a 2-D vector array.
 
subroutine utils_mod::getvecpair2d (fname, wdir, cosrot, sinrot, vname1, vgrid1, vname2, vgrid2, dims, vecpair)
 Obtain 2D vector pairs mapped to Ct and rotated to EN.
 
subroutine utils_mod::getvecpair3d (fname, wdir, cosrot, sinrot, vname1, vgrid1, vname2, vgrid2, dims, vecpair)
 Obtain 3D vector pairs mapped to Ct and rotated to EN.
 
subroutine, public utils_mod::nf90_err (ierr, string)
 Handle netcdf errors.
 
subroutine utils_mod::packarrays2d (filesrc, wgtsdir, cosrot, sinrot, vars, dims, nflds, fields)
 Pack 2D fields into arrays by mapping type.
 
subroutine utils_mod::packarrays3d (filesrc, wgtsdir, cosrot, sinrot, vars, dims, nflds, fields)
 Pack 3D fields into arrays by mapping type.
 
subroutine utils_mod::remap1d (fname, src_field, dst_field)
 Remap a 1-D vector array from source to destination.
 
subroutine utils_mod::remap2d (fname, dim2, src_field, dst_field)
 Remap a 2-D vector array of nflds or nlevs from source to destination.
 
subroutine utils_mod::remap3d (fname, nk, nflds, src_field, dst_field)
 Remap a field packed array of nk levels and nflds fields.
 
subroutine, public utils_mod::zero_out_land_ice (mask, fout, icnt)
 Reset field values to zero on land.
 
subroutine, public utils_mod::zero_out_phantom_ice (fin, fout, icnt)
 Ensure that when fin contains zeros for all ncat, fout will also contain zeros for all ncat.
 

Detailed Description

Define utility procedures.

Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

This module defines a set of utility procedures

Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition in file utils_mod.F90.

Function/Subroutine Documentation

◆ dumpnc1d()

subroutine utils_mod::dumpnc1d ( character(len=*), intent(in) fname,
character(len=*), intent(in) vname,
integer, dimension(:), intent(in) dims,
real(kind=8), dimension(:), intent(in) field )
private

Write a bare netcdf file of a unpacked 2D field.

Parameters
[in]fnamethe file containing ESMF regridding weights
[in]vnamethe name of the variable
[in]dimsthe variable spatial dimensions
[in]fieldthe field to write
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 674 of file utils_mod.F90.

◆ dumpnc2d()

subroutine utils_mod::dumpnc2d ( character(len=*), intent(in) fname,
character(len=*), intent(in) vname,
integer, dimension(:), intent(in) dims,
integer, intent(in) nflds,
real(kind=8), dimension(:,:), intent(in) field )
private

Write a bare netcdf file of a 2D packed field.

Parameters
[in]fnamethe file containing ESMF regridding weights
[in]vnamethe name of the variable
[in]dimsthe variable spatial dimensions
[in]nfldsthe number of fields
[in]fieldthe field to write
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 546 of file utils_mod.F90.

◆ dumpnc3d()

subroutine utils_mod::dumpnc3d ( character(len=*), intent(in) fname,
character(len=*), intent(in) vname,
integer, dimension(:), intent(in) dims,
integer, intent(in) nk,
integer, intent(in) nflds,
real(kind=8), dimension(:,:,:), intent(in) field )
private

Write a bare netcdf file of a packed 3D field.

Parameters
[in]fnamethe file containing ESMF regridding weights
[in]vnamethe name of the variable
[in]dimsthe variable spatial dimensions
[in]nkthe number of levels
[in]nfldsthe number of fields
[in]fieldthe field to write
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 589 of file utils_mod.F90.

◆ dumpnc3dk()

subroutine utils_mod::dumpnc3dk ( character(len=*), intent(in) fname,
character(len=*), intent(in) vname,
integer, dimension(:), intent(in) dims,
real(kind=8), dimension(:,:), intent(in) field )
private

Write a bare netcdf file of an unpacked 3D field.

Parameters
[in]fnamethe file containing ESMF regridding weights
[in]vnamethe name of the variable
[in]dimsthe variable spatial dimensions
[in]fieldthe field to write
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 633 of file utils_mod.F90.

◆ getfield2d()

subroutine utils_mod::getfield2d ( character(len=*), intent(in) fname,
character(len=*), intent(in) vname,
integer, dimension(:), intent(in) dims,
real(kind=8), dimension(:), intent(out) field,
character(len=*), intent(in), optional wgts )
private

Obtain a 2D field and return a 1-D vector array.

Parameters
[in]fnamethe file containing the fields to retrieve
[in]vnamethe variable to retrieve
[in]dimsthe dimensions of the fields
[out]fieldthe field
[in]wgtsthe optional ESMF regridding weights
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 287 of file utils_mod.F90.

◆ getfield3d()

subroutine utils_mod::getfield3d ( character(len=*), intent(in) fname,
character(len=*), intent(in) vname,
integer, dimension(:), intent(in) dims,
real(kind=8), dimension(:,:), intent(out) field,
character(len=*), intent(in), optional wgts )
private

Obtain a 3D field and return a 2-D vector array.

Parameters
[in]fnamethe file containing the fields to retrieve
[in]vnamethe variable to retrieve
[in]dimsthe dimensions of the fields
[out]fieldthe field
[in]wgtsthe optional ESMF regridding weights
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 332 of file utils_mod.F90.

◆ getvecpair2d()

subroutine utils_mod::getvecpair2d ( character(len=*), intent(in) fname,
character(len=*), intent(in) wdir,
real(kind=8), dimension(:), intent(in) cosrot,
real(kind=8), dimension(:), intent(in) sinrot,
character(len=*), intent(in) vname1,
character(len=*), intent(in) vgrid1,
character(len=*), intent(in) vname2,
character(len=*), intent(in) vgrid2,
integer, dimension(:), intent(in) dims,
real(kind=8), dimension(:,:), intent(out) vecpair )
private

Obtain 2D vector pairs mapped to Ct and rotated to EN.

Parameters
[in]fnamethe file containing the fields to retrieve
[in]wdirthe path to the required ESMF regridding weights
[in]cosrotthe cosine of the rotation angle
[in]sinrotthe sine of the rotation angle
[in]vname1the variable name of the first vector
[in]vgrid1the grid location of the first vector
[in]vname2the variable name of the second vector
[in]vgrid2the grid location of the second vector
[in]dimsthe dimensions of the fields
[out]vecpairthe vector pair array
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 192 of file utils_mod.F90.

◆ getvecpair3d()

subroutine utils_mod::getvecpair3d ( character(len=*), intent(in) fname,
character(len=*), intent(in) wdir,
real(kind=8), dimension(:), intent(in) cosrot,
real(kind=8), dimension(:), intent(in) sinrot,
character(len=*), intent(in) vname1,
character(len=*), intent(in) vgrid1,
character(len=*), intent(in) vname2,
character(len=*), intent(in) vgrid2,
integer, dimension(:), intent(in) dims,
real(kind=8), dimension(:,:,:), intent(out) vecpair )
private

Obtain 3D vector pairs mapped to Ct and rotated to EN.

Parameters
[in]fnamethe file containing the fields to retrieve
[in]wdirthe path to the required ESMF regridding weights
[in]cosrotthe cosine of the rotation angle
[in]sinrotthe sine of the rotation angle
[in]vname1the variable name of the first vector
[in]vgrid1the grid location of the first vector
[in]vname2the variable name of the second vector
[in]vgrid2the grid location of the second vector
[in]dimsthe dimensions of the fields
[out]vecpairthe vector pair array
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 242 of file utils_mod.F90.

◆ nf90_err()

subroutine, public utils_mod::nf90_err ( integer, intent(in) ierr,
character(len=*), intent(in) string )

Handle netcdf errors.

Parameters
[in]ierrthe error code
[in]stringthe error message
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 763 of file utils_mod.F90.

◆ packarrays2d()

subroutine utils_mod::packarrays2d ( character(len=*), intent(in) filesrc,
character(len=*), intent(in) wgtsdir,
real(kind=8), dimension(:), intent(in) cosrot,
real(kind=8), dimension(:), intent(in) sinrot,
type(vardefs), dimension(:), intent(in) vars,
integer, dimension(:), intent(in) dims,
integer, intent(in) nflds,
real(kind=8), dimension(:,:), intent(out) fields )
private

Pack 2D fields into arrays by mapping type.

Parameters
[in]filesrcthe file containing the fields to retrieve
[in]wgtsdirthe path to the required ESMF regridding weights
[in]cosrotthe cosine of the rotation angle
[in]sinrotthe sine of the rotation angle
[in]varsthe typedefs for this packed array
[in]dimsthe dimensions of the fields in the packed array
[in]nfldsthe number of fields in the packed array
[out]fieldsthe packed array
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 66 of file utils_mod.F90.

◆ packarrays3d()

subroutine utils_mod::packarrays3d ( character(len=*), intent(in) filesrc,
character(len=*), intent(in) wgtsdir,
real(kind=8), dimension(:), intent(in) cosrot,
real(kind=8), dimension(:), intent(in) sinrot,
type(vardefs), dimension(:), intent(in) vars,
integer, dimension(:), intent(in) dims,
integer, intent(in) nflds,
real(kind=8), dimension(:,:,:), intent(out) fields )
private

Pack 3D fields into arrays by mapping type.

Parameters
[in]filesrcthe file containing the fields to retrieve
[in]wgtsdirthe path to the required ESMF regridding weights
[in]cosrotthe cosine of the rotation angle
[in]sinrotthe sine of the rotation angle
[in]varsthe typedefs for this packed array
[in]dimsthe dimensions of the fields in the packed array
[in]nfldsthe number of fields in the packed array
[out]fieldsthe packed array
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 128 of file utils_mod.F90.

◆ remap1d()

subroutine utils_mod::remap1d ( character(len=*), intent(in) fname,
real(kind=8), dimension(:), intent(in) src_field,
real(kind=8), dimension(:), intent(out) dst_field )
private

Remap a 1-D vector array from source to destination.

Parameters
[in]fnamethe file containing ESMF regridding weights
[in]src_fieldthe source field
[out]dst_fieldthe destination field
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 377 of file utils_mod.F90.

◆ remap2d()

subroutine utils_mod::remap2d ( character(len=*), intent(in) fname,
integer, intent(in) dim2,
real(kind=8), dimension(:,:), intent(in) src_field,
real(kind=8), dimension(:,:), intent(out) dst_field )
private

Remap a 2-D vector array of nflds or nlevs from source to destination.

Parameters
[in]fnamethe file containing ESMF regridding weights
[in]dim2the number of fields or levels
[in]src_fieldthe source field
[out]dst_fieldthe destination field
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 432 of file utils_mod.F90.

◆ remap3d()

subroutine utils_mod::remap3d ( character(len=*), intent(in) fname,
integer, intent(in) nk,
integer, intent(in) nflds,
real(kind=8), dimension(:,:,:), intent(in) src_field,
real(kind=8), dimension(:,:,:), intent(out) dst_field )
private

Remap a field packed array of nk levels and nflds fields.

Parameters
[in]fnamethe file containing ESMF regridding weights
[in]nkthe number of levels
[in]nfldsthe number of fields
[in]src_fieldthe source field
[out]dst_fieldthe destination field
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 489 of file utils_mod.F90.

◆ zero_out_land_ice()

subroutine, public utils_mod::zero_out_land_ice ( integer(kind=4), dimension(:), intent(in) mask,
real(kind=8), dimension(:,:), intent(inout) fout,
integer, intent(out) icnt )

Reset field values to zero on land.

Parameters
[in]maskthe land mask
[in,out]foutthe field value
[out]icntthe number spatial points reset
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 711 of file utils_mod.F90.

◆ zero_out_phantom_ice()

subroutine, public utils_mod::zero_out_phantom_ice ( real(kind=8), dimension(:,:), intent(in) fin,
real(kind=8), dimension(:,:), intent(inout) fout,
integer, intent(out) icnt )

Ensure that when fin contains zeros for all ncat, fout will also contain zeros for all ncat.

Parameters
[in]finthe field to test against
[in,out]foutthe field tested
[out]icntthe number spatial points reset
Author
Denis.nosp@m.e.Wo.nosp@m.rthen.nosp@m.@noa.nosp@m.a.gov

Definition at line 738 of file utils_mod.F90.