Metadata-Version: 2.4
Name: medenv
Version: 2.0.0
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: netCDF4>=1.5.8
Requires-Dist: tqdm>=4.66.1
Requires-Dist: pandas>=2.1.3
Requires-Dist: xarray>=2023.11.0
Requires-Dist: lxml>=4.9.3
Requires-Dist: copernicusmarine>=2.0.1
Dynamic: license-file


# Environmental measures from mediterranean see

<p align="right">
<a href="https://anaconda.org/conda-forge/medenv"><img src="https://anaconda.org/conda-forge/medenv/badges/version.svg"></a>
<a href="https://pypi.python.org/pypi/medenv/"><img src="https://badge.fury.io/py/medenv.svg" alt="PyPi Version"/></a>
<a href="https://github.com/jeremyfix/medenv?tab=GPL-3.0-1-ov-file#readme"><img src="https://img.shields.io/github/license/jeremyfix/medenv" alt="License"/></a>
</p>

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 = 6

values, 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.
