ocnice_prep  1.13.0
All Data Structures Files Functions Variables Pages
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. More...
 
subroutine utils_mod::dumpnc2d (fname, vname, dims, nflds, field)
 Write a bare netcdf file of a 2D packed field. More...
 
subroutine utils_mod::dumpnc3d (fname, vname, dims, nk, nflds, field)
 Write a bare netcdf file of a packed 3D field. More...
 
subroutine utils_mod::dumpnc3dk (fname, vname, dims, field)
 Write a bare netcdf file of an unpacked 3D field. More...
 
subroutine utils_mod::getfield2d (fname, vname, dims, field, wgts)
 Obtain a 2D field and return a 1-D vector array. More...
 
subroutine utils_mod::getfield3d (fname, vname, dims, field, wgts)
 Obtain a 3D field and return a 2-D vector array. More...
 
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. More...
 
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. More...
 
subroutine, public utils_mod::nf90_err (ierr, string)
 Handle netcdf errors. More...
 
subroutine utils_mod::packarrays2d (filesrc, wgtsdir, cosrot, sinrot, vars, dims, nflds, fields)
 Pack 2D fields into arrays by mapping type. More...
 
subroutine utils_mod::packarrays3d (filesrc, wgtsdir, cosrot, sinrot, vars, dims, nflds, fields)
 Pack 3D fields into arrays by mapping type. More...
 
subroutine utils_mod::remap1d (fname, src_field, dst_field)
 Remap a 1-D vector array from source to destination. More...
 
subroutine utils_mod::remap2d (fname, dim2, src_field, dst_field)
 Remap a 2-D vector array of nflds or nlevs from source to destination. More...
 
subroutine utils_mod::remap3d (fname, nk, nflds, src_field, dst_field)
 Remap a field packed array of nk levels and nflds fields. More...
 

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 673 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 545 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 588 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 632 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 286 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 331 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 191 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 241 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 709 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 65 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 127 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 376 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 431 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 488 of file utils_mod.F90.