Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeremyfix/medenv
Script to add envrionmental variables as provided by CMEMS, etopo given latitude, longitude, time, depth
https://github.com/jeremyfix/medenv
Last synced: 5 days ago
JSON representation
Script to add envrionmental variables as provided by CMEMS, etopo given latitude, longitude, time, depth
- Host: GitHub
- URL: https://github.com/jeremyfix/medenv
- Owner: jeremyfix
- License: gpl-3.0
- Created: 2023-11-25T05:42:47.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-02-27T14:22:46.000Z (8 months ago)
- Last Synced: 2024-09-30T10:35:31.714Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 55.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Environmental measures from mediterranean see
This package provides several utilities for requesting environmental measures in the Mediterrannean see.
## Installation
In order to install the package, you can install the latest release with :
pip install medenv
You can also install, using pip, the current version on the main branch by either :
python3 -m pip install git+https://github.com/jeremyfix/medenv.git
Or, you can also install it by cloning the repository
git clone https://github.com/jeremyfix/medenv.git
python3 -m venv venv
source venv/bin/activate
python -m pip install medenv## Usage
Check the examples in the `examples/` directory, but basically, grabbing environmental variables require a `Fetcher` to which you specify which features you want to grab and then provides `(latitude, longitude, time, depth)` requests:
``` python
features = [
"sea-surface-temperature",
"sea-surface-salinity",
"bathymetry",
"temperature",
"salinity",
"chlorophyl-a",
"nitrate",
"phosphate",
"ammonium",
"phytoplankton-carbon-biomass",
"oxygen",
"net-primary-production",
"ph",
"alkalinity",
"dissolved-inorganic-carbon",
"northward-water-velocity",
"eastward-water-velocity",
# 2D features
"mixed-layer-thickness",
"sea-surface-above-geoid",
"surface-partial-pressure-co2",
"surface-co2-flux",
]fetcher = medenv.Fetcher(features, reduction="mean")
date = datetime.datetime(year=2012, month=9, day=22, hour=14)
long, lat = 13.63, 43.55
tol_spatial = 0.2
long0 = (long - tol_spatial / 2, long + tol_spatial / 2)
lat0 = (lat - tol_spatial / 2, lat + tol_spatial / 2)
depth = 6values, info_values = fetcher.get_values(date, (long0, lat0), depth)
```The request accepts a range for the longitude/latitude and a single value for the date and depth. For both the date and depth, the fetcher will grab the closest values.