Contact: | Jeff Anderson |
Reviewers: | |
Revision: | $Revision: 1.7 $ |
Release Name: | $Name: $ |
Change Date: | $Date: 2006/09/11 14:35:32 $ |
Change history: | see CVS log (cop-out, I know) |
Optional arguments are enclosed in brackets [like this].
Provides a representation of a physical location on 1-D periodic domain. 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 three-dimensional spherical shell).
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) :: x end type location_type
Provides an abstract representation of physical location on a one-dimensional periodic domain.
Component | Description |
---|---|
x | Location has range 0 to 1 |
type get_close_type private integer :: num real(r8) :: maxdist end type get_close_type
Provides a structure for doing efficient computation of close locations. Doesn't do anything in the 1D implementation except provide appropriate stubs.
Component | Description |
---|---|
num | Number of observations in list |
maxdist | Threshhold distance. Anything closer is close. |
real(r8), intent(inout) :: get_location type(location_type), intent(in) :: loc
Extracts the real location value, range 0 to 1, from a location type.
get_location | The real location |
loc | A location type |
type(location_type), intent(in) :: set_location real(r8), intent(in) :: x
Returns a location type with the location x.
set_location | A location type |
x | Location range 0 to 1 |
integer, intent(in) :: locfile type(location_type), intent(in) :: 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.
locfile | the unit number of the open file. |
loc | location type to be written. |
fform | Format specifier (FORMATTED or UNFORMATTED). |
type(location_type) :: read_location integer, intent(in) :: locfile character(len=*), optional, intent(in) :: fform
Reads a location_type from a file open on channel locfile using format fform (default is formatted).
read_location | Returned location type read from file |
locfile | 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 elements of location type to 0 |
type(location_type) :: set_location_missing
Returns a location with location set to missing value from types_mod.
set_location_missing | A location set to missing value |
real(r8), intent(out) :: query_location type(location_type), intent(in) :: loc character(len=*), optional, intent(in) :: attr
Returns the value of x (model state component of location type) if attr = 'X' or if attr is not passed.
query_location | Returns value of x. |
loc | A location type |
attr | Selects 'X' |
type(get_close_type), intent(inout) :: gc integer, intent(in) :: num type(location_type), dimension(:) intent(in) :: obs
Initialize storage for efficient identification of locations close to a given location. The oned implementation is minimal and just records the number of locations here.
gc | Structure that contains data to efficiently find locations close to a given location. |
num | The number of locations in the list. |
obs | The locations of each element in the list, not used in 1D implementation. |
type(get_close_type), intent(in) :: gc type(location_type), intent(in) :: base_obs_loc integer, intent(in) :: base_obs_kind type(location_type), dimension(:), intent(in) :: obs integer, dimension(:), intent(in) :: obs_kind integer, intent(out) :: num_close integer, dimension(:), intent(out) :: close_ind real(r8), dimension(:), intent(out) :: dist
Given a single location and a list of other locations, returns the indices of all the locations close to the single one along with the number of these and the distances for the close ones.
gc | Structure to allow efficient identification of locations close to a given location. |
base_obs_loc | Single given location. |
base_obs_kind | Kind of the single location. |
obs | List of observations from which close ones are to be found. |
obs_kind | Kind associated with observations in obs list. |
num_close | Number of observations close to the given location. |
close_ind | Indices of those locations that are close. |
dist | Distance between given location and the close ones identified in close_ ind. |
type(get_close_type), intent(inout) :: gc real(r8), intent(in) :: maxdist
Sets the threshhold distance. Anything closer that this is deemed to be close.
gc | Data for efficiently finding close locations. |
maxdist | Anything closer than this distance is a close location. |
Routine | Message | Comment |
---|---|---|
set_location | Value of x is out of 0->1 range | x cannot be less than 0 or greater than 1 |
query_location | Only x is legal attribute to request from location | attr must be 'x' or 'X' |
read_location | Expected location header "loc1d" in input file | Can only read one-dimensional location files |
None.
Eventually, a more general file descriptor type should replace the use of the integer unit number.