cgul
Common Generalised Uniform and Light. Python package which will be used to ensure consistent data format when working with Xarray type data objects.
Usage
The primary function in cgul is cgul.translate_coords. This function operates on an xarray.Dataset or
xarray.DataArray and translates the coordinates to the specified coordinate model. Several coordinate models
are included in the package, and users are recommended to use the default CADS coordinate model. A typical
use case woould be:
import xarray as xr
import cgul
infile = 'data_file.nc'
data = xr.open_dataset(infile)
# To harmonise the coordinates and unit names:
data_cgul = cgul.harmonise(
data,
coord_model=cgul.coordinate_models.CADS # This is the default value, so optional in this case
)
# To just harmonise the coordinates:
data_cgul = cgul.translate_coordinates(
data,
coord_model=cgul.coordinate_models.CADS # This is the default value, so optional in this case
)
It is is also possible to use command line executables to check files can be harmonised, or to produce netCDF files with harmonised coordinates and metadata:
# To check that $INFILE has contents that can be harmonised,
# this will print out the harmonised xarray.Dataset:
cgul harmonise --check $INFILE
# To produce an ouput file, $OUTFILE, which contains the harmonised version of
# the contents of $INFILE:
cgul harmonise --output $OUTFILE $INFILE
Workflow for developers/contributors
For best experience create a new conda environment (e.g. DEVELOP) with Python 3.10:
conda create -n DEVELOP -c conda-forge python=3.10
conda activate DEVELOP
Before pushing to GitHub, run the following commands:
- Update conda environment:
make conda-env-update - Install this package:
pip install -e . - Sync with the latest template (optional):
make template-update - Run quality assurance checks:
make qa - Run tests:
make unit-tests - Build the documentation (see Sphinx tutorial):
make docs-build
License
Copyright 2017-2022, European Union.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Metadata
Release files for cgul 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cgul-0.0.4.tar.gz | 29.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cgul-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 53.8 kB
Release files / cgul-0.0.4.tar.gz
| Download URL | cgul-0.0.4.tar.gz |
|---|---|
| Size | 29.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec4b66d914e207146c3cb84c5cf816328097f43928cf5229cf14b9297989cc1b
|
|
BLAKE2b-256 checksum How to use checksums |
b4683c73c5ecc82341f6bf1141f7e860a45daf04b2dbc26b912c935026acdd85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Release files / cgul-0.0.4-py3-none-any.whl
| Download URL | cgul-0.0.4-py3-none-any.whl |
|---|---|
| Size | 24.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dff4307a1ea279e1aa605647e5bc23a37cd83c0fa52ba423b816dc4b1630d12b
|
|
BLAKE2b-256 checksum How to use checksums |
28b3d08a8adddcf859aa1a2c5dd892de8141bab293f0533aec5e36d7565286cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|