read.siteinfo {Rglimclim} | R Documentation |
This function is intended as a convenient way to read site information from old GLIMCLIM
(rather than Rglimclim
) site definition files, and to store the result in a format that can be used directly as an argument to other routines such as GLCfit
.
read.siteinfo(site.file, nhead = 38, which.coords=NULL, regions=NULL)
site.file |
A file containing site information, in the format specified in the Details section below. The file should contain three sections: a header containing |
nhead |
Number of header rows in |
which.coords |
For many purposes (e.g. fitting spatial correlation structures, calculating distance-weighted averages of lagged values) it is necessary to calculate distances between sites. This argument is used to define which attributes will be used to calculate (Euclidean) distances, if more than two attributes are defined (if one or two attributes are defined, these are automatically used for distance calculations). The default value is |
regions |
An optional data frame giving names of regions or subareas, in the format returned by |
The structure of the site.file
file is tightly specified (a Fortran 77
relic). The first line after the header should contain a single integer (n.attr
, say) which is the number of site attributes to be defined. The subsequent n.attr
lines contain text describing each attribute: this will be used in labelling model output.
After the attribute definition section of the file, there is a line which is ignored by this routine (in previous versions of GLIMCLIM
this contained text "****END OF ATTRIBUTE DEFINITION****"); this is followed by the final section of the file which is used to specify the details of individual sites. Each site is defined on two lines: the first contains a text string giving the site name and the second looks something like:
CODE REGION ATTRIB[1] ... ATTRIB[2] ... ATTRIB[n.attr]
where CODE
is a 4-character code used to identify the site, REGION
is the number of the region in which the site lies (as defined using read.regiondef
or define.regions
- this field is optional, with a value of 0 or blank associating the site with no region), and ATTRIB[]
are the values of the various attributes for the site (in the order specified in the ‘attribute definition’ section). CODE
occupies the first 4 positions of the line; REGION
occupies positions 5-9; and each successive attribute occupies the first 10 free positions of the line starting with position 10.
There is no limit to the number of sites that can be defined, or to the number of attributes that can be defined for each site.
See help for make.siteinfo
.
Richard Chandler (richard@stats.ucl.ac.uk)
make.siteinfo
to define sites based on information held in a data frame, GLCfit
require(Rglimclim) ## ## Valid siteinfo.def file required in current working directory ## # siteinfo <- read.siteinfo("siteinfo.def")