spcomp
spcomp(string
,species
)
The SPCOMP decoding function has the following arguments:
string
The full species composition string
species
The species value to extract.
This function decodes species composition strings, like used in the Ontario MNRF. These strings list species codes and percent composition in 6 character tuples (3 char spp code + 3 digit percent), e.g. "Sb 50Pj 30Bx 10Po 10" compliant with the FIM standard.
Species codes are decoded in a case insensitive manner. 'SB' and 'Sb' refer to the same species code. If a species comp string contains duplicate species code values then the respective percent values will be added together. The decoding will try to automatically decode the older 4 character STANF format (3 char spp code + 1 digit decile, where 0 = 100%).
Decoding is performed by calling spcomp with two string arguments. The first is the species composition string, the second is the species code of interest. The function will return the percentage found in the composition string. For example,
spcomp('Pj 70Po 30', 'Pj')
will return a number representing the percent composition of 'Pj' found in the input species composition string.
Attempts to decode a species code that is not in the input composition string will result in a zero value.
spcomp(species
,percentage
,...
)
The SPCOMP encoding function has the following arguments:
species
The species code to encode
percentage
The percentage value to be encoded with species.
...
Additional species code and percentagee values may be repeated to fully describe the stand composition.
This function encodes a series of species codes and percentage values. The values are summed and sorted, and the FIM compliant species composition string is composed of the provided values. For example,
spcomp('Pj', 70, 'Po', 30)
will return a FIM compilant string 'Pj 70Po 30'.
The species composition percentage values will be summed and, if less than 100, the values will be pro-rated up to percentages.
Formula |
Description |
Result |
---|---|---|
spcomp('Pj 70Po 30', 'Pj') |
Extract the percent composition of Pj |
70 |
spcomp('Po', 30, 'Pj, 70) |
Encode the species composition, sorting values in to the correct order |
'Pj 07Po 30' |
spcomp('Pj, 3, 'Po', 1) |
Encode the species composition, prorating the percentage values |
'Pj 75Po 25' |