[![PyPI version](https://badge.fury.io/py/coast.svg)](https://badge.fury.io/py/coast)
[![Conda COAsT version](https://img.shields.io/conda/v/bodc/coast.svg)](https://anaconda.org/bodc/coast)
[![Anaconda-Server Badge](https://anaconda.org/bodc/coast/badges/latest_release_relative_date.svg)](https://anaconda.org/bodc/coast)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4041413.svg)](https://zenodo.org/record/4041413)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
```
__________________________________________________________________________________________
______ ___ _ _________
.' ___ | .' `. / \ | _ _ |
/ .' \_|/ .-. \ / _ \ .--.|_/ | | \_|
| | | | | | / ___ \ ( (`\] | |
\ `.___.'\\ `-' /_/ / \ \_ `'.'. _| |_
`.____ .' `.___.'|____| |____|[\__) )|_____|
Coastal Ocean Assessment Toolbox
__________________________________________________________________________________________
```
COAsT is Diagnostic and Assessment toolbox for kilometric scale regional models.
It's aim is to deliver a flexible, community-ready framework for assessing kilometric scale ocean models. The focus, initially, is be on delivering novel diagnostics for processes that are emergent at the kilometric scale and with NEMO model output. The framework leans heavily on xarray.
Documentation can be found [here](https://british-oceanographic-data-centre.github.io/COAsT/).
![PyPI version](https://badge.fury.io/py/COAsT.svg)
![Anaconda version](https://anaconda.org/bodc/coast/badges/version.svg)
## Notes on Object Structure and Loading (for contributors):
COAsT is an object-orientated package, meaning that data is stored within Python object
structures. In addition to data storage, these objects contain methods (subroutines)
which allow for manipulation of this data. An example of such an object is the Gridded
object, which allows for the storage and manipulation of (e.g.) NEMO output and domain data. It
is important to understand how to load data using COAsT and the structure of the resulting
objects.
A Gridded object is created and initialised by passing it the paths of the domain and data
files. Ideally, the grid type should also be specified (T, U, V or F in the case of NEMO).
For example, to load in data from a file containing data on a NEMO T-grid:
```
import coast
fn_data = "<path to T-grid data file(s)>"
fn_domain = "<path to domain file>"
fn_config = "<path to JSON config file>"
data = coast.Gridded(fn_data, fn_domain, fn_config)
```
Ideally, Gridded model output data should be in grid-specific files, i.e.
containing output variables situated on a NEMO T, U, V or F grid, whereas the
grid variables are in a single domain file. On loading into COAsT, only the
grid specific variables appropriate for the paired data are placed into the
Gridded object. A Gridded object therefore contains grid-specific data and all
corresponding grid variables. One of the file names can be omitted (to get a
data-only or grid only object), however functionality in this case will be
limited.
Once loaded, data is stored inside the object using an xarray.dataset object.
Following on from the previous code example, this can be viewed by calling:
```
data.dataset
```
This reveals all netcdf-type aspects of the data and domain variables that were loaded,
including dimensions, coordinates, variables and attributes. For example:
```
<xarray.Dataset>
Dimensions: (axis_nbounds: 2, t_dim: 7, x_dim: 297, y_dim: 375, z_dim: 51)
Coordinates:
time (t_dim) datetime64[ns] 2007-01-01T11:58:56 ... 2007-01-31T11:58:56
longitude (y_dim, x_dim) float32 ...
latitude (y_dim, x_dim) float32 ...
Dimensions without coordinates: axis_nbounds, t_dim, x_dim, y_dim, z_dim
Data variables:
deptht_bounds (z_dim, axis_nbounds) float32 ...
sossheig (t_dim, y_dim, x_dim) float32 ...
time_counter_bounds (t_dim, axis_nbounds) datetime64[ns] ...
time_instant (t_dim) datetime64[ns] ...
temperature (t_dim, z_dim, y_dim, x_dim) float32 ...
e1 (y_dim, x_dim) float32 ...
e2 (y_dim, x_dim) float32 ...
e3_0 (z_dim, y_dim, x_dim) float32 1.0 1.0 1.0 ... 1.0 1.0
```
Variables may be obtained in a number of ways. For example, to get temperature data, the
following are all equivalent:
```
temp = data.dataset.temperature
temp = data.dataset['temperature']
temp = data['temperature']
```
These commands will all return an xarray.dataarray object. Manipulation of this object
can be done using xarray commands, for example indexing using [] or xarray.isel. Be aware
that indexing will preserve lazy loading, however and direct access or modifying of the
data will not. For this reason, if you require a subset of the data, it is best to
index first.
The names of common grid variables are standardised within the COAsT package
using JSON configuration files. For example, the following lists COAsT internal
variable followed by the typical NEMO variable names:
1. longitude [glamt / glamu / glamv / glamf]
2. latitude [gphit / gphiu / gphiv / gphif]
3. time [time_counter]
4. e1 [e1t / e1u / e1v / e1f] (dx variable)
5. e2 [e1t / e1u / e1v / e1f] (dy variable)
6. e3_0 [e3t_0 / e3u_0 / e3v_0 / e3f_0] (dz variable at time 0)
Longitude, latitude and time are also set as coordinates. You might notice that dimensions
are also standardised:
1. x_dim The dimension for the x-axis (longitude)
2. y_dim The dimension for the y-axis (latitude)
3. t_dim The dimension for the time axis
4. z_dim The dimension for the depth axis.
Wherever possible, the aim is to ensure that all of the above is consistent across the
whole COAsT toolbox. Therefore, you will also find the same names and dimensions in, for
example observation objects. Future objects, where applicable, will also follow these
conventions. If you (as a contributor) add new objects to the toolbox, following
the above template is strongly encouraged. This includes using xarray dataset/dataarray
objects where possible, adopting an object oriented approach and adhering to naming
conventions.
Raw data
{
"_id": null,
"home_page": "https://www.bodc.ac.uk",
"name": "COAsT",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<3.11",
"maintainer_email": "",
"keywords": "NEMO,shallow water,ocean assessment",
"author": "British Oceanographic Data Centre (BODC)",
"author_email": "bodcsoft@bodc.ac.uk",
"download_url": "https://files.pythonhosted.org/packages/9b/22/b58bc7b0c8b4fe15388eee5c74f41d939c1835c10a59e9002f319ea24adb/COAsT-3.3.0.tar.gz",
"platform": null,
"description": "[![PyPI version](https://badge.fury.io/py/coast.svg)](https://badge.fury.io/py/coast)\n[![Conda COAsT version](https://img.shields.io/conda/v/bodc/coast.svg)](https://anaconda.org/bodc/coast)\n[![Anaconda-Server Badge](https://anaconda.org/bodc/coast/badges/latest_release_relative_date.svg)](https://anaconda.org/bodc/coast)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4041413.svg)](https://zenodo.org/record/4041413)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n```\n__________________________________________________________________________________________\n\n\n ______ ___ _ _________\n .' ___ | .' `. / \\ | _ _ |\n / .' \\_|/ .-. \\ / _ \\ .--.|_/ | | \\_|\n | | | | | | / ___ \\ ( (`\\] | | \n \\ `.___.'\\\\ `-' /_/ / \\ \\_ `'.'. _| |_ \n `.____ .' `.___.'|____| |____|[\\__) )|_____| \n\n Coastal Ocean Assessment Toolbox\n\n__________________________________________________________________________________________\n```\n\nCOAsT is Diagnostic and Assessment toolbox for kilometric scale regional models.\nIt's aim is to deliver a flexible, community-ready framework for assessing kilometric scale ocean models. The focus, initially, is be on delivering novel diagnostics for processes that are emergent at the kilometric scale and with NEMO model output. The framework leans heavily on xarray.\n\nDocumentation can be found [here](https://british-oceanographic-data-centre.github.io/COAsT/).\n\n![PyPI version](https://badge.fury.io/py/COAsT.svg)\n![Anaconda version](https://anaconda.org/bodc/coast/badges/version.svg)\n\n## Notes on Object Structure and Loading (for contributors):\n\nCOAsT is an object-orientated package, meaning that data is stored within Python object\nstructures. In addition to data storage, these objects contain methods (subroutines)\nwhich allow for manipulation of this data. An example of such an object is the Gridded\nobject, which allows for the storage and manipulation of (e.g.) NEMO output and domain data. It\nis important to understand how to load data using COAsT and the structure of the resulting\nobjects.\n\nA Gridded object is created and initialised by passing it the paths of the domain and data\nfiles. Ideally, the grid type should also be specified (T, U, V or F in the case of NEMO).\nFor example, to load in data from a file containing data on a NEMO T-grid:\n\n```\nimport coast\n\nfn_data = \"<path to T-grid data file(s)>\"\nfn_domain = \"<path to domain file>\"\nfn_config = \"<path to JSON config file>\"\ndata = coast.Gridded(fn_data, fn_domain, fn_config)\n```\n\nIdeally, Gridded model output data should be in grid-specific files, i.e.\ncontaining output variables situated on a NEMO T, U, V or F grid, whereas the\ngrid variables are in a single domain file. On loading into COAsT, only the\ngrid specific variables appropriate for the paired data are placed into the\nGridded object. A Gridded object therefore contains grid-specific data and all\ncorresponding grid variables. One of the file names can be omitted (to get a\n data-only or grid only object), however functionality in this case will be\n limited.\n\nOnce loaded, data is stored inside the object using an xarray.dataset object.\nFollowing on from the previous code example, this can be viewed by calling:\n\n```\ndata.dataset\n```\nThis reveals all netcdf-type aspects of the data and domain variables that were loaded,\nincluding dimensions, coordinates, variables and attributes. For example:\n```\n<xarray.Dataset>\nDimensions: (axis_nbounds: 2, t_dim: 7, x_dim: 297, y_dim: 375, z_dim: 51)\n\nCoordinates:\n time (t_dim) datetime64[ns] 2007-01-01T11:58:56 ... 2007-01-31T11:58:56\n longitude (y_dim, x_dim) float32 ...\n latitude (y_dim, x_dim) float32 ...\nDimensions without coordinates: axis_nbounds, t_dim, x_dim, y_dim, z_dim\n\nData variables:\n deptht_bounds (z_dim, axis_nbounds) float32 ...\n sossheig (t_dim, y_dim, x_dim) float32 ...\n time_counter_bounds (t_dim, axis_nbounds) datetime64[ns] ...\n time_instant (t_dim) datetime64[ns] ...\n temperature (t_dim, z_dim, y_dim, x_dim) float32 ...\n e1 (y_dim, x_dim) float32 ...\n e2 (y_dim, x_dim) float32 ...\n e3_0 (z_dim, y_dim, x_dim) float32 1.0 1.0 1.0 ... 1.0 1.0\n```\nVariables may be obtained in a number of ways. For example, to get temperature data, the\nfollowing are all equivalent:\n```\ntemp = data.dataset.temperature\ntemp = data.dataset['temperature']\ntemp = data['temperature']\n```\nThese commands will all return an xarray.dataarray object. Manipulation of this object\ncan be done using xarray commands, for example indexing using [] or xarray.isel. Be aware\nthat indexing will preserve lazy loading, however and direct access or modifying of the\ndata will not. For this reason, if you require a subset of the data, it is best to\nindex first.\n\nThe names of common grid variables are standardised within the COAsT package\nusing JSON configuration files. For example, the following lists COAsT internal\nvariable followed by the typical NEMO variable names:\n\n1. longitude [glamt / glamu / glamv / glamf]\n2. latitude [gphit / gphiu / gphiv / gphif]\n3. time [time_counter]\n4. e1 [e1t / e1u / e1v / e1f] (dx variable)\n5. e2 [e1t / e1u / e1v / e1f] (dy variable)\n6. e3_0 [e3t_0 / e3u_0 / e3v_0 / e3f_0] (dz variable at time 0)\n\nLongitude, latitude and time are also set as coordinates. You might notice that dimensions\nare also standardised:\n\n1. x_dim The dimension for the x-axis (longitude)\n2. y_dim The dimension for the y-axis (latitude)\n3. t_dim The dimension for the time axis\n4. z_dim The dimension for the depth axis.\n\nWherever possible, the aim is to ensure that all of the above is consistent across the\nwhole COAsT toolbox. Therefore, you will also find the same names and dimensions in, for\nexample observation objects. Future objects, where applicable, will also follow these\nconventions. If you (as a contributor) add new objects to the toolbox, following\nthe above template is strongly encouraged. This includes using xarray dataset/dataarray\nobjects where possible, adopting an object oriented approach and adhering to naming\nconventions.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "This is the Coast Ocean Assessment Tool",
"version": "3.3.0",
"project_urls": {
"Download": "https://github.com/British-Oceanographic-Data-Centre/COAsT/",
"Homepage": "https://www.bodc.ac.uk",
"documentation": "https://british-oceanographic-data-centre.github.io/COAsT/"
},
"split_keywords": [
"nemo",
"shallow water",
"ocean assessment"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7d58da7fe1ae6453199c70dfaf1d8e076aa2806ab73e093cd16c6912e922cf20",
"md5": "24c68eeef2d82132cfbb505220cbf069",
"sha256": "397a98ee6ed98f11c575d261ad1b2f7f5cf4d3d7a7e5d481e80a1aabbccbfefb"
},
"downloads": -1,
"filename": "COAsT-3.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "24c68eeef2d82132cfbb505220cbf069",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<3.11",
"size": 132164,
"upload_time": "2023-12-11T17:48:14",
"upload_time_iso_8601": "2023-12-11T17:48:14.077061Z",
"url": "https://files.pythonhosted.org/packages/7d/58/da7fe1ae6453199c70dfaf1d8e076aa2806ab73e093cd16c6912e922cf20/COAsT-3.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9b22b58bc7b0c8b4fe15388eee5c74f41d939c1835c10a59e9002f319ea24adb",
"md5": "6b6d2996d165a43b53f2a2277ecbaebf",
"sha256": "80f044f6c1f88d7954b6021264cff1fab25178cdcb37f3dab1f8301f459e7b42"
},
"downloads": -1,
"filename": "COAsT-3.3.0.tar.gz",
"has_sig": false,
"md5_digest": "6b6d2996d165a43b53f2a2277ecbaebf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<3.11",
"size": 123799,
"upload_time": "2023-12-11T17:48:16",
"upload_time_iso_8601": "2023-12-11T17:48:16.411344Z",
"url": "https://files.pythonhosted.org/packages/9b/22/b58bc7b0c8b4fe15388eee5c74f41d939c1835c10a59e9002f319ea24adb/COAsT-3.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-11 17:48:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "British-Oceanographic-Data-Centre",
"github_project": "COAsT",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "PyYAML",
"specs": [
[
"==",
"6.0"
]
]
},
{
"name": "oyaml",
"specs": [
[
"==",
"1.0"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"7.1.1"
]
]
},
{
"name": "pytest-mock",
"specs": [
[
"==",
"3.7.0"
]
]
},
{
"name": "numpy",
"specs": [
[
">=",
"1.22.3"
]
]
},
{
"name": "dask",
"specs": [
[
">=",
"2022.3.0"
]
]
},
{
"name": "dask",
"specs": [
[
">=",
"2022.3.0"
]
]
},
{
"name": "xarray",
"specs": [
[
">=",
"2022.3.0"
]
]
},
{
"name": "matplotlib",
"specs": [
[
">=",
"3.5.3"
]
]
},
{
"name": "netCDF4",
"specs": [
[
">=",
"1.5.8"
]
]
},
{
"name": "scipy",
"specs": [
[
">=",
"1.8.0"
]
]
},
{
"name": "gsw",
"specs": [
[
">=",
"3.6.17"
]
]
},
{
"name": "utide",
"specs": [
[
">=",
"0.3.0"
]
]
},
{
"name": "scikit-learn",
"specs": [
[
">=",
"1.0.2"
]
]
},
{
"name": "scikit-image",
"specs": [
[
">=",
"0.19.2"
]
]
},
{
"name": "statsmodels",
"specs": [
[
">=",
"0.13.2"
]
]
},
{
"name": "pydap",
"specs": [
[
">=",
"3.2.2"
]
]
},
{
"name": "tqdm",
"specs": [
[
">=",
"4.66.1"
]
]
},
{
"name": "pyproj",
"specs": [
[
">=",
"3.5.0"
]
]
},
{
"name": "lxml",
"specs": [
[
">=",
"4.9.0"
]
]
},
{
"name": "requests",
"specs": [
[
">=",
"2.27.1"
]
]
}
],
"lcname": "coast"
}