XScape
A Python library for recovering the seascape around a set of geographical points, based on Xarray.
Why XScape?
XScape can help you whenever you want to add environmental information to georeferenced events. The information may come from satellites, numerical models, or any field represented on a latitude/longitude grid.
The library was originally developed as part of the PPR Océan & Climat, a research project funded by the French government.
Installation
Installing XScape is as simple as running:
pip install xscape
You may also install the library directly by cloning the repository.
Once you have it on your own machine, go into the XScape directory and run poetry install.
The whole process can be done in three commands:
git clone https://github.com/Articoking/XScape.git
cd XScape
poetry install
If you want to contribute to the library, follow the specific installation instructions in the documentation.
Basic usage
To use XScape, you only need two things:
- A list of points in a pandas DataFrame with
latandlonas columns. - An Xarray DataArray containing the "background" variable in a regular latitude/longitude grid.
Let's start by generating some points in the South Atlantic Ocean
import xarray as xr
import xscape as xscp
n_points = 10
points = xscp.generate_points(
n_points,
lon_range = (-50, 20),
lat_range = (-60, 0)
)
In this example, we'll use XScape functions to get Sea Surface Temperature data from GLORYS. To do that, we need to first define the size of the seascape we want to get around each point, in this case 1°. XScape uses this information to avoid requesting an area much larger than that covered by the points.
seascape_size = 1 # degrees
glorys_var = xscp.get_glorys_var(
points,
seascape_size,
'thetao', # Temperature variable name
start_datetime = "2000-01-01",
end_datetime = "2000-12-31",
)
glorys_var = glorys_var.isel(time=0, depth=0) # See note below
NOTE: XScape can also create seascapes with time and depth dimensions, through the seascape_timerange and get_column parameters in create_xscp_da() respectively. Consult the API documentation for more detail.
Finally, we create our "XScape DataArray" using the create_xscp_da() function:
xscp_da = xscp.create_xscp_da(
points,
seascape_size,
glorys_var
)
This is a regular Xarray DataArray object with a special format that makes working with seascapes quite simple. For example, you can easily select the seascape that corresponds to the first point in your list:
first_point = points.iloc[0]
seascape = xscp_da.xscp.ss_sel(first_point)
For more information on the format of XScape DataArrays refer to the dedicated documentation page.
Related works
If XScape does not fit your needs, consider taking a look at geoenrich.
Metadata
Release files for xscape 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xscape-0.3.1.tar.gz | 23.3 kB | Without provenance | Details for xscape-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xscape-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for xscape-0.3.1-py3-none-any.whl |
Total release size: 47.5 kB
Release files / xscape-0.3.1.tar.gz
| Download URL | xscape-0.3.1.tar.gz |
|---|---|
| Size | 23.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
496a8910902cf696513cca53b5dc38c48df06646498dbcb956481f37243850cb
|
|
BLAKE2b-256 checksum How to use checksums |
0be6dd11310340f744c4b80184dbb0b87f86d717ec3db54a7204c94a1aa0a36e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/6.17.0-14-generic
|
Release files / xscape-0.3.1-py3-none-any.whl
| Download URL | xscape-0.3.1-py3-none-any.whl |
|---|---|
| Size | 24.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
970a4b251867cce74164ab346b28fe710b9c49f2122fba03347c39d8539bf18f
|
|
BLAKE2b-256 checksum How to use checksums |
383a12bf20001e59a953c444bad1ab6f0cc635e4a73c2a2d67378031dd5c6a21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/6.17.0-14-generic
|
Security for xscape 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.