orog_mask_tools  1.13.0
orog_utils Module Reference

Module containing utilites used by the orog program. More...

Functions/Subroutines

subroutine, public find_nearest_pole_points (i_north_pole, j_north_pole, i_south_pole, j_south_pole, im, jm, is_north_pole, is_south_pole)
 Find the point on the model grid tile closest to the north and south pole. More...
 
subroutine, public find_poles (geolat, nx, ny, i_north_pole, j_north_pole, i_south_pole, j_south_pole)
 Find the point on the model grid tile closest to the north and south pole. More...
 
subroutine, public get_index (imn, jmn, npts, lonO, latO, delxn, jst, jen, ilist, numx)
 Determine the location of a cubed-sphere point within the high-resolution orography data. More...
 
real function, public get_lat_angle (dy)
 Convert the 'y' direction distance of a cubed-sphere grid point to the corresponding distance in latitude. More...
 
real function, public get_lon_angle (dx, lat_in)
 Convert the 'x' direction distance of a cubed-sphere grid point to the corresponding distance in longitude. More...
 
real function, public get_xnsum (lon1, lat1, lon2, lat2, imn, jmn, glat, zavg, zslm, delxn)
 Count the number of high-resolution orography points that are higher than the model grid box average orography height. More...
 
subroutine, public get_xnsum2 (lon1, lat1, lon2, lat2, imn, jmn, glat, zavg, delxn, xnsum1, xnsum2, hc)
 Count the number of high-resolution orography points that are higher than a critical value inside a model grid box (or a portion of a model grid box). More...
 
subroutine, public get_xnsum3 (lon1, lat1, lon2, lat2, imn, jmn, glat, zavg, delxn, xnsum1, xnsum2, HC)
 Count the number of high-resolution orography points that are higher than a critical value inside a model grid box (or a portion of a model grid box). More...
 
logical function, public inside_a_polygon (lon1, lat1, npts, lon2, lat2)
 Check if a point is inside a polygon. More...
 
subroutine, public latlon2xyz (siz, lon, lat, x, y, z)
 Convert from latitude and longitude to x,y,z coordinates. More...
 
subroutine, public minmax (im, jm, a, title, imax, jmax)
 Print out the maximum and minimum values of an array and optionally pass back the i/j location of the maximum. More...
 
subroutine, public remove_isolated_pts (im, jm, slm, oro, var, var4, oa, ol)
 Remove isolated model points. More...
 
real function spherical_angle (v1, v2, v3)
 Compute spherical angle. More...
 
real function, public timef ()
 Get the date/time from the system clock. More...
 
subroutine, public transpose_mask (imn, jmn, mask)
 Transpose the global landmask by flipping the poles and moving the starting longitude to Greenwich. More...
 
subroutine, public transpose_orog (imn, jmn, glob)
 Transpose the global orography data by flipping the poles and moving the starting longitude to Greenwich. More...
 

Variables

real, parameter deg2rad = 3.14159265358979/180.
 degrees per radians. More...
 
real, parameter earth_radius = 6371200.
 earth radius in meters. More...
 
real, parameter pi =3.1415926535897931
 pi. More...
 
real, parameter rad2deg = 180./3.14159265358979
 radians per degrees. More...
 

Detailed Description

Module containing utilites used by the orog program.

Author
George Gayno NOAA/EMC

Function/Subroutine Documentation

◆ find_nearest_pole_points()

subroutine, public orog_utils::find_nearest_pole_points ( integer, intent(in)  i_north_pole,
integer, intent(in)  j_north_pole,
integer, intent(in)  i_south_pole,
integer, intent(in)  j_south_pole,
integer, intent(in)  im,
integer, intent(in)  jm,
logical, dimension(im,jm), intent(out)  is_north_pole,
logical, dimension(im,jm), intent(out)  is_south_pole 
)

Find the point on the model grid tile closest to the north and south pole.

Parameters
[in]i_north_pole'i' index of north pole. '0' if pole is outside of grid.
[in]j_north_pole'j' index of north pole. '0' if pole is outside of grid.
[in]i_south_pole'i' index of south pole. '0' if pole is outside of grid.
[in]j_south_pole'j' index of south pole. '0' if pole is outside of grid.
[in]imi-dimension of model tile
[in]jmj-dimension of model tile
[out]is_north_pole'true' for points surrounding the north pole.
[out]is_south_pole'true' for points surrounding the south pole.
Author
GFDL Programmer

Definition at line 487 of file orog_utils.F90.

Referenced by io_utils::read_mdl_grid_file().

◆ find_poles()

subroutine, public orog_utils::find_poles ( real, dimension(nx+1,ny+1), intent(in)  geolat,
integer, intent(in)  nx,
integer, intent(in)  ny,
integer, intent(out)  i_north_pole,
integer, intent(out)  j_north_pole,
integer, intent(out)  i_south_pole,
integer, intent(out)  j_south_pole 
)

Find the point on the model grid tile closest to the north and south pole.

Parameters
[in]geolatLatitude on the supergrid.
[in]nxi-dimension of the supergrid.
[in]nyj-dimension of the supergrid.
[out]i_north_pole'i' index of north pole. '0' if pole is outside of grid.
[out]j_north_pole'j' index of north pole. '0' if pole is outside of grid.
[out]i_south_pole'i' index of south pole. '0' if pole is outside of grid.
[out]j_south_pole'j' index of south pole. '0' if pole is outside of grid.
Author
GFDL Programmer

Definition at line 411 of file orog_utils.F90.

Referenced by io_utils::read_mdl_grid_file().

◆ get_index()

subroutine, public orog_utils::get_index ( integer, intent(in)  imn,
integer, intent(in)  jmn,
integer, intent(in)  npts,
real, dimension(npts), intent(in)  lonO,
real, dimension(npts), intent(in)  latO,
real, intent(in)  delxn,
integer, intent(out)  jst,
integer, intent(out)  jen,
integer, dimension(imn), intent(out)  ilist,
integer, intent(out)  numx 
)

Determine the location of a cubed-sphere point within the high-resolution orography data.

The location is described by the range of i/j indices on the high-res grid.

Parameters
[in]imn'i' dimension of the high-resolution orography data set.
[in]jmn'j' dimension of the high-resolution orography data set.
[in]nptsNumber of vertices to describe the cubed-sphere point.
[in]lonOThe longitudes of the cubed-sphere vertices. Must range from 0 - 360.
[in]latOThe latitudes of the cubed-sphere vertices.
[in]delxnResolution of the high-resolution orography data set.
[out]jstStarting 'j' index on the high-resolution grid.
[out]jenEnding 'j' index on the high-resolution grid.
[out]ilistList of 'i' indices on the high-resolution grid.
[out]numxThe number of 'i' indices on the high-resolution grid.
Author
GFDL programmer

Definition at line 691 of file orog_utils.F90.

Referenced by make_mask(), makemt2(), makeoa2(), and makepc2().

◆ get_lat_angle()

real function, public orog_utils::get_lat_angle ( real, intent(in)  dy)

Convert the 'y' direction distance of a cubed-sphere grid point to the corresponding distance in latitude.

Parameters
[in]dyDistance along the 'y' direction of a cubed-sphere point in meters.
Returns
get_lat_angle Corresponding latitudinal distance in degrees.
Author
GFDL programmer

Definition at line 128 of file orog_utils.F90.

References earth_radius, and rad2deg.

Referenced by makeoa2().

◆ get_lon_angle()

real function, public orog_utils::get_lon_angle ( real, intent(in)  dx,
real, intent(in)  lat_in 
)

Convert the 'x' direction distance of a cubed-sphere grid point to the corresponding distance in longitude.

Parameters
[in]dxDistance along the 'x' direction of a cubed-sphere grid point in meters.
[in]lat_inLatitude of the cubed-sphere point in degrees.
Returns
get_lon_angle Corresponding distance in longitude in degrees.
Author
GFDL programmer

Definition at line 152 of file orog_utils.F90.

References deg2rad, earth_radius, and rad2deg.

Referenced by makeoa2().

◆ get_xnsum()

real function, public orog_utils::get_xnsum ( real, intent(in)  lon1,
real, intent(in)  lat1,
real, intent(in)  lon2,
real, intent(in)  lat2,
integer, intent(in)  imn,
integer, intent(in)  jmn,
real, dimension(jmn), intent(in)  glat,
integer, dimension(imn,jmn), intent(in)  zavg,
integer, dimension(imn,jmn), intent(in)  zslm,
real, intent(in)  delxn 
)

Count the number of high-resolution orography points that are higher than the model grid box average orography height.

Parameters
[in]lon1Longitude of corner point 1 of the model grid box.
[in]lat1Latitude of corner point 1 of the model grid box.
[in]lon2Longitude of corner point 2 of the model grid box.
[in]lat2Latitude of corner point 2 of the model grid box.
[in]imn'i' dimension of the high-resolution orography data.
[in]jmn'j' dimension of the high-resolution orography data.
[in]glatLatitude of each row of the high-resolution orography data.
[in]zavgThe high-resolution orography.
[in]zslmThe high-resolution land mask.
[in]delxnResolution of the high-res orography data.
Returns
get_xnsum The number of high-res points above the mean orography.
Author
GFDL Programmer

Definition at line 793 of file orog_utils.F90.

Referenced by makeoa2().

◆ get_xnsum2()

subroutine, public orog_utils::get_xnsum2 ( real, intent(in)  lon1,
real, intent(in)  lat1,
real, intent(in)  lon2,
real, intent(in)  lat2,
integer, intent(in)  imn,
integer, intent(in)  jmn,
real, dimension(jmn), intent(in)  glat,
integer, dimension(imn,jmn), intent(in)  zavg,
real, intent(in)  delxn,
real, intent(out)  xnsum1,
real, intent(out)  xnsum2,
real, intent(out)  hc 
)

Count the number of high-resolution orography points that are higher than a critical value inside a model grid box (or a portion of a model grid box).

The critical value is a function of the standard deviation of orography.

Parameters
[in]lon1Longitude of corner point 1 of the model grid box.
[in]lat1Latitude of corner point 1 of the model grid box.
[in]lon2Longitude of corner point 2 of the model grid box.
[in]lat2Latitude of corner point 2 of the model grid box.
[in]imn'i' dimension of the high-resolution orography data.
[in]jmn'j' dimension of the high-resolution orography data.
[in]glatLatitude of each row of the high-resolution orography data.
[in]zavgThe high-resolution orography.
[in]delxnResolution of the high-res orography data.
[out]xnsum1The number of high-resolution orography above the critical value inside a model grid box.
[out]xnsum2The number of high-resolution orography points inside a model grid box.
[out]hcCritical height.
Author
GFDL Programmer

Definition at line 904 of file orog_utils.F90.

Referenced by makeoa2().

◆ get_xnsum3()

subroutine, public orog_utils::get_xnsum3 ( real, intent(in)  lon1,
real, intent(in)  lat1,
real, intent(in)  lon2,
real, intent(in)  lat2,
integer, intent(in)  imn,
integer, intent(in)  jmn,
real, dimension(jmn), intent(in)  glat,
integer, dimension(imn,jmn), intent(in)  zavg,
real, intent(in)  delxn,
real, intent(out)  xnsum1,
real, intent(out)  xnsum2,
real, intent(in)  HC 
)

Count the number of high-resolution orography points that are higher than a critical value inside a model grid box (or a portion of a model grid box).

Unlike routine get_xnsum2(), this routine does not compute the critical value. Rather, it is passed in.

Parameters
[in]lon1Longitude of corner point 1 of the model grid box.
[in]lat1Latitude of corner point 1 of the model grid box.
[in]lon2Longitude of corner point 2 of the model grid box.
[in]lat2Latitude of corner point 2 of the model grid box.
[in]imn'i' dimension of the high-resolution orography data.
[in]jmn'j' dimension of the high-resolution orography data.
[in]glatLatitude of each row of the high-resolution orography data.
[in]zavgThe high-resolution orography.
[in]delxnResolution of the high-res orography data.
[out]xnsum1The number of high-resolution orography above the critical value inside a model grid box.
[out]xnsum2The number of high-resolution orography points inside a model grid box.
[in]hcCritical height.
Author
GFDL Programmer

Definition at line 1006 of file orog_utils.F90.

Referenced by makeoa2().

◆ inside_a_polygon()

logical function, public orog_utils::inside_a_polygon ( real, intent(in)  lon1,
real, intent(in)  lat1,
integer, intent(in)  npts,
real, dimension(npts), intent(in)  lon2,
real, dimension(npts), intent(in)  lat2 
)

Check if a point is inside a polygon.

Parameters
[in]lon1Longitude of the point to check.
[in]lat1Latitude of the point to check.
[in]nptsNumber of polygon vertices.
[in]lon2Longitude of the polygon vertices.
[in]lat2Latitude of the polygon vertices.
Returns
inside_a_polygon When true, point is within the polygon.
Author
GFDL programmer

Definition at line 318 of file orog_utils.F90.

References latlon2xyz(), pi, and spherical_angle().

Referenced by make_mask(), makemt2(), makeoa2(), and makepc2().

◆ latlon2xyz()

subroutine, public orog_utils::latlon2xyz ( integer, intent(in)  siz,
real, dimension(siz), intent(in)  lon,
real, dimension(siz), intent(in)  lat,
real, dimension(siz), intent(out)  x,
real, dimension(siz), intent(out)  y,
real, dimension(siz), intent(out)  z 
)

Convert from latitude and longitude to x,y,z coordinates.

Parameters
[in]sizNumber of points to convert.
[in]lonLongitude (radians) of points to convert.
[in]latLatitude (radians) of points to convert.
[out]x'x' Coordinate of the converted points.
[out]y'y' Coordinate of the converted points.
[out]z'z' Coordinate of the converted points.
Author
GFDL programmer

Definition at line 101 of file orog_utils.F90.

Referenced by inside_a_polygon().

◆ minmax()

subroutine, public orog_utils::minmax ( integer, intent(in)  im,
integer, intent(in)  jm,
real, dimension(im,jm), intent(in)  a,
character(len=8), intent(in)  title,
integer, intent(out), optional  imax,
integer, intent(out), optional  jmax 
)

Print out the maximum and minimum values of an array and optionally pass back the i/j location of the maximum.

Parameters
[in]imThe 'i' dimension of the array.
[in]jmThe 'j' dimension of the array.
[in]aThe array to check.
[in]titleName of the data to be checked.
[out]imaxThe 'i' location of the maximum.
[out]jmaxThe 'j' location of the maximum.
Author
Jordan Alpert NOAA/EMC

Definition at line 50 of file orog_utils.F90.

Referenced by tersub().

◆ remove_isolated_pts()

subroutine, public orog_utils::remove_isolated_pts ( integer, intent(in)  im,
integer, intent(in)  jm,
real, dimension(im,jm), intent(inout)  slm,
real, dimension(im,jm), intent(inout)  oro,
real, dimension(im,jm), intent(inout)  var,
real, dimension(im,jm), intent(inout)  var4,
real, dimension(im,jm,4), intent(inout)  oa,
real, dimension(im,jm,4), intent(inout)  ol 
)

Remove isolated model points.

Parameters
[in]im'i' dimension of a model grid tile.
[in]jm'j' dimension of a model grid tile.
[in,out]slmLand-mask on the model tile.
[in,out]oroOrography on the model tile.
[in,out]varStandard deviation of orography on the model tile.
[in,out]var4Convexity on the model tile.
[in,out]oaOrographic asymmetry on the model tile.
[in,out]olOrographic length scale on the model tile.
Author
Jordan Alpert NOAA/EMC

Definition at line 561 of file orog_utils.F90.

Referenced by tersub().

◆ spherical_angle()

real function orog_utils::spherical_angle ( real, dimension(3), intent(in)  v1,
real, dimension(3), intent(in)  v2,
real, dimension(3), intent(in)  v3 
)
private

Compute spherical angle.

Parameters
[in]v1Vector 1.
[in]v2Vector 2.
[in]v3Vector 3.
Returns
spherical_angle Spherical Angle.
Author
GFDL programmer

Definition at line 262 of file orog_utils.F90.

References pi.

Referenced by inside_a_polygon().

◆ timef()

real function, public orog_utils::timef ( )

Get the date/time from the system clock.

Returns
timef
Author
Mark Iredell

Definition at line 1064 of file orog_utils.F90.

Referenced by tersub().

◆ transpose_mask()

subroutine, public orog_utils::transpose_mask ( integer, intent(in)  imn,
integer, intent(in)  jmn,
integer(1), dimension(imn,jmn), intent(inout)  mask 
)

Transpose the global landmask by flipping the poles and moving the starting longitude to Greenwich.

Parameters
[in]imni-dimension of landmask data.
[in]jmnj-dimension of landmask data.
[in,out]maskThe global landmask data.
Author
G. Gayno

Definition at line 177 of file orog_utils.F90.

Referenced by io_utils::read_global_mask().

◆ transpose_orog()

subroutine, public orog_utils::transpose_orog ( integer, intent(in)  imn,
integer, intent(in)  jmn,
integer(2), dimension(imn,jmn), intent(inout)  glob 
)

Transpose the global orography data by flipping the poles and moving the starting longitude to Greenwich.

Parameters
[in]imni-dimension of orography data.
[in]jmnj-dimension of orography data.
[in,out]globThe global orography data.
Author
G. Gayno

Definition at line 220 of file orog_utils.F90.

Referenced by io_utils::read_global_orog().

Variable Documentation

◆ deg2rad

real, parameter orog_utils::deg2rad = 3.14159265358979/180.
private

degrees per radians.

Definition at line 17 of file orog_utils.F90.

Referenced by get_lon_angle().

◆ earth_radius

real, parameter orog_utils::earth_radius = 6371200.
private

earth radius in meters.

Definition at line 14 of file orog_utils.F90.

Referenced by get_lat_angle(), and get_lon_angle().

◆ pi

real, parameter orog_utils::pi =3.1415926535897931
private

pi.

Definition at line 15 of file orog_utils.F90.

Referenced by inside_a_polygon(), and spherical_angle().

◆ rad2deg

real, parameter orog_utils::rad2deg = 180./3.14159265358979
private

radians per degrees.

Definition at line 16 of file orog_utils.F90.

Referenced by get_lat_angle(), and get_lon_angle().