Contact: | Jeff Anderson |
Reviewers: | |
Revision: | $Revision: 1.3 $ |
Release Name: | $Name: pre_hawaii $ |
Change Date: | $Date: 2004/12/22 20:48:13 $ |
Change history: | see CVS log (cop-out, I know) |
A note about documentation style. Optional arguments are enclosed in brackets [like this].
Provides a representation of a physical location on a 3-D spherical shell. A type that abstracts the location is provided along with operators to compute the distance between two locations. This is a member of a class of similar location modules that provide the same abstraction for different represenations of physical space (for instance a one-dimensional periodic domain for low-order modules).
types_mod utilities_mod random_seq_mod
Optional namelist interface &location_nml may be read from file input.nml.
type location_type private real(r8) :: lon, lat, vloc integer :: which_vert end type location_type
Provides an abstract representation of physical location on a three-d spherical shell.
Component | Description |
---|---|
lon | longitude in radians |
lat | latitude in radians |
vloc | vertical location, units as selected by which_vert |
which_vert | type of vertical location: -1=surface; 1=level; 2=pressure; 3=height |
real(r8), dimension(3), intent(inout) :: get_location type(location_type), intent(in) :: loc
Extracts the longitude and latitude (converted to degrees) and the vertical location from a location type and returns in a 3 element real array.
get_location | The longitude and latitude (in degrees) and vertical location |
loc | A location type |
type(location_type), intent(in) :: set_location real(r8), intent(in) :: lon real(r8), intent(in) :: lat real(r8), intent(in) :: vert_loc integer, intent(in) :: which_vert
Returns a location type with the input longitude and latitude (input in degrees) and the vertical location of type specified by which_vert.
set_location | A location type |
lon | Longitude in degrees |
lat | Latitude in degrees |
vert_loc | Vertical location consistent with which_vert |
which_vert | The vertical location type |
integer, intent(in) :: file type(location_type), intent(inout) :: loc character(len=*), optional, intent(in) :: fform
Given an integer IO channel of an open file and a location, writes the location to this file. The fform argument controls whether write is "FORMATTED" or "UNFORMATTED" with default being formatted.
file | the unit number of the open file. |
loc | location type to be written. |
fform | Format specifier (FORMATTED or UNFORMATTED). |
Eventually, a more general file descriptor type should replace the use of the integer unit number.
type(location_type), intent(in) :: loc1, loc2 real(r8) :: var
Returns the distance between two locations. If horiz_only is set to true just computes great circle distance on sphere. If horiz_only is false, then computes an ellipsoidal distance with the horizontal component as above and the vertical distance determined by the types of the locations and the normalization constants set by the namelist for the different vertical coordinate types. The vertical normalization gives the vertical distance that is equally weighted as a horizontal distance of 1 radian.
loc1 | first location. |
loc2 | second location. |
var | distance between loc1 and loc2. |
type(location_type) :: read_location integer, intent(in) :: ifile character(len=*), optional, intent(in) :: fform
Reads a location_type from a file open on channel ifile using format fform (default is formatted).
read_location | Returned location type read from file |
ifile | Integer channel opened to a file to be read |
fform | Optional format specifier (FORMATTED or UNFORMATTED) |
type(location_type), intent(out) :: location logical, optional, intent(in) :: set_to_default
Use standard input to define a location type. With set_to_default true get one with all elements set to 0.
location | Location created from standard input |
set_to_default | If true, sets all elments of location type to 0 |
type(location_type), intent(in) :: set_location_missing
Returns a location with all elements set to missing values defined in types module.
set_location_missing | A location with all elements set to missing values |
logical :: vert_is_pressure type(location_type), intent(in) :: loc
Returns true if which_vert is for pressure, else false.
vert_is_pressure | Returns true if vertical coordinate type is pressure |
loc | A location type |
logical :: vert_is_level type(location_type), intent(in) :: loc
Returns true if which_vert is for level, else false.
vert_is_level | Returns true if vertical coordinate type is level |
loc | A location type |
logical :: vert_is_height type(location_type), intent(in) :: loc
Returns true if which_vert is for height, else false.
vert_is_height | Returns true if vertical coordinate type is height |
loc | A location type |
real(r8), intent(out) :: query_location type(location_type), intent(in) :: loc character(len=*), optional, intent(in) :: attr
Returns the value of which_vert, latitude, longitude, or vertical location from a location type as selected by the string argument attr. If attr is not present or if it is 'WHICH_VERT', the value of which_vert is converted to real and returned. Otherwise, attr='LON' returns longitude, attr='LAT' returns latitude and attr='VLOC' returns the vertical location.
query_location | Returns longitude, latitude, vertical location, or which_vert (converte d to real) |
loc | A location type |
attr | Selects 'WHICH_VERT', 'LON', 'LAT' or 'VLOC' |
We adhere to the F90 standard of starting a namelist with an ampersand '&' and terminating with a slash '/'.
namelist / location_nml / & horiz_dist_only, vert_normalization_pressure, vert_normalization_height, & vert_normalization_level
Controls the way in which distance is computed. If horiz_distance_only is false, then the appropriate normalization constant determines the relative impact of vertical and horizontal separation.
This namelist is read in a file called input.nml
Contents | Type | Description |
---|---|---|
horiz_dist_only | logical | Only compute horizontal distance component? Default: true |
vert_normalization_pressure | real(r8) | How many hectopascals should be equivalent distance to one radian? Default: 1000000.0 |
vert_normalization_height | real(r8) | How many geopotential meters should be equal to one radian? Default: 10000.0 |
vert_normalization_level | real(r8) | How many model levels should be equal to one radian? Default: 20.0 |
Routine | Message | Comment |
---|---|---|
get_dist | Dont know how to compute vertical distance for unlike vertical coordinates | Need same which_vert for distances. |
None.