or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

atmospheric-indicators.mdconversion-indicators.mdcore-computation.mdensemble-analysis.mdfire-weather.mdindex.mdland-indicators.mdsea-ice-indicators.mdspatial-analogs.mdstatistical-downscaling.mdstatistical-indicators.mdutilities.md

spatial-analogs.mddocs/

0

# Spatial Analogs

1

2

Spatial analog analysis for identifying regions with similar climate characteristics. Useful for climate adaptation, impact assessment, and identifying climate refugia or risk areas.

3

4

## Capabilities

5

6

### Spatial Analog Computation

7

8

Methods for finding spatial analogs based on climate similarity metrics.

9

10

```python { .api }

11

def spatial_analogs(reference, candidates, method="kldiv", **kwargs):

12

"""

13

Find spatial analogs using climate similarity metrics.

14

15

Parameters:

16

- reference: xr.Dataset, reference climate data

17

- candidates: xr.Dataset, candidate regions for analog search

18

- method: str, similarity metric ("kldiv", "euclidean", "mahalanobis")

19

- **kwargs: method-specific parameters

20

21

Returns:

22

xr.Dataset: Spatial analog results with similarity scores

23

"""

24

```

25

26

## Usage Examples

27

28

```python

29

import xarray as xr

30

import xclim.analog as xca

31

32

# Load reference and candidate climate data

33

reference = xr.open_dataset("reference_region.nc")

34

candidates = xr.open_dataset("global_climate.nc")

35

36

# Find spatial analogs

37

analogs = xca.spatial_analogs(

38

reference,

39

candidates,

40

method="kldiv"

41

)

42

```