# Sindex: Shape Index In SpatialVx: Spatial Forecast Verification

## Description

Calculate the shape index (Sindex) as described in AghaKouchak et al. (2011)

## Usage

 ```1 2 3 4 5 6 7 8 9``` ```Sindex(x, thresh = NULL, ...) ## Default S3 method: Sindex(x, thresh = NULL, ..., loc = NULL) ## S3 method for class 'SpatialVx' Sindex(x, thresh = NULL, ..., time.point = 1, obs = 1, model = 1) ```

## Arguments

 `x` Default: m by n numeric matrix giving the field for which the shape index is to be calculated. `Sindex.SpatialVx`: list object of class “SpatialVx”. `thresh` numeric giving a threshold under which (and including, i.e., <=) all values are set to zero, and the shape index is calculated for the non-zero (positive-valued) grid-points. `loc` (optional) mn by 2 numeric matrix giving the grid point locations. If NULL, the expanded grid with x=1:m and y=1:n is used. `time.point` numeric or character indicating which time point from the “SpatialVx” verification set to select for analysis. `obs, model` numeric indicating which observation/forecast model to select for the analysis. `...` Not used.

## Details

The shape index introduced in AghaKouchak et al. (2011) is defined as

Sindex = Pmin/P,

where for n = the number of positive-valued grid points, Pmin = 4*sqrt(n) if floor(sqrt(n)) = sqrt(n), and Pmin = 2 * floor(2*sqrt(n)+1) otherwise. P is the permieter of the non-zero grid points. Range is 0 to 1. Values closer to 1 indicate shapes that are closer to circular.

## Value

numeric with named components:

 `Sindex` the shape index `Pmin,P` the numerator and denominator (perimeter) that make the Sindex.

For “SpatialVx” objects, the routine is applied to both the verification and forecast objects so that a two-row matrix is returned containing the above vectors for each field.

Eric Gilleland

## References

AghaKouchak, A., Nasrohllahi, N., Li, J., Imam, B. and Sorooshian, S. (2011) Geometrical characterization of precipitation patterns. J. Hyrdometeorology, 12, 274–285, doi:10.1175/2010JHM1298.1.

`Cindex`, `Aindex`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24``` ```# Re-create Fig. 7a from AghaKouchak et al. (2011). tmp <- matrix(0, 8, 8) tmp[3,2:4] <- 1 tmp[5,4:6] <- 1 tmp[7,6:7] <- 1 Sindex(tmp) ## Not run: # Two separate areas with highly structured shapes, but far away from each other. data( "pert000" ) data( "pert006" ) data( "ICPg240Locs" ) hold <- make.SpatialVx( pert000, pert006, loc = ICPg240Locs, projection = TRUE, map = TRUE, loc.byrow = TRUE, field.type = "Precipitation", units = "mm/h", data.name = "ICP Perturbed Cases", obs.name = "pert000", model.name = "pert006" ) plot( hold ) Sindex( hold ) ## End(Not run) ```