Metadata-Version: 2.4
Name: Alaea
Version: 2.5.5
Summary: Some simple tools by Christmas
Author: Christmas
Author-email: 273519355@qq.com
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: netCDF4
Requires-Dist: cftime
Requires-Dist: xarray
Requires-Dist: pandas
Requires-Dist: matplotlib
Requires-Dist: colorlog
Requires-Dist: requests
Requires-Dist: scipy
Provides-Extra: gdal
Requires-Dist: GDAL; extra == "gdal"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license-file
Dynamic: license-expression
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Alaea

## Installation

```shell
pip3 install Alaea
```

KML 转 Shapefile 是可选功能，需要 GDAL：

```shell
pip3 install 'Alaea[gdal]'
```

## Release

Direct execution cleans old artifacts, builds the package, uploads it with
Twine, and cleans the artifacts after a successful upload:

```shell
./run_twine.py
```

Use `--repository NAME` to select a configured Twine repository. A failed build
does not attempt upload; a failed upload retains the new archives for diagnosis
and retry.

## Unified spatial interpolation

`s2s`, `g2s`, `s2g`, and `g2g` use the same argument order. `s` means
scattered points and `g` means a grid. Grid coordinates may be one-dimensional
longitude/latitude axes or matching two-dimensional coordinate arrays.

```python
import numpy as np
from Alaea.exutils import g2s, s2g

lon = np.array([120.0, 121.0])
lat = np.array([30.0, 31.0])
value = np.array([[1.0, 2.0], [3.0, 4.0]])

point_value = g2s(lon, lat, value, 120.5, 30.5)

station_lon = np.array([120.0, 121.0, 120.0, 121.0])
station_lat = np.array([30.0, 30.0, 31.0, 31.0])
station_value = np.array([1.0, 2.0, 3.0, 4.0])
grid_value = s2g(station_lon, station_lat, station_value, lon, lat)
```

All four functions accept `method="linear"`, `method="nearest"`,
`method="cubic"`, or `method="idw"`. IDW also accepts `neighbors` (default 8)
and `power` (default 2). Data may have leading dimensions such as
`(time, lat, lon)` or `(time, point)`; these dimensions are preserved in the
result.

## Coastline filling

```python
from Alaea.baysalt.erosion_coastline import erosion_cal_id, erosion_via_id

weight = erosion_cal_id(lon, lat, value, k=4, judge_num=1, method='np.nan')
filled = erosion_via_id(weight, value)
```

`method` may be `np.nan`, `nc.mask`, or `txt.mask`. The input used to calculate
weights must be two-dimensional; applying weights supports any data whose last
two dimensions are latitude and longitude.

Legacy file-generation helpers remain available from their explicit modules,
for example `Alaea.exutils.Interp.Interp_g2s.Grid2Sca`, but are no longer
re-exported from `Alaea.exutils`; new interpolation code should use the four
unified functions above.
