forked from NCAS-CMS/cfdm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
executable file
·211 lines (182 loc) · 6.26 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
import fnmatch
import os
import re
from setuptools import setup
# from setuptools import setup
def find_package_data_files(directory):
"""TODO."""
for root, dirs, files in os.walk(directory):
for basename in files:
if fnmatch.fnmatch(basename, "*"):
filename = os.path.join(root, basename)
yield filename.replace("cfdm/", "", 1)
def _read(fname):
"""Returns content of a file."""
fpath = os.path.dirname(__file__)
fpath = os.path.join(fpath, fname)
with open(fpath, "r") as file_:
return file_.read()
def _get_version():
"""Returns library version by inspecting core/__init__.py file."""
return re.search(
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
_read("cfdm/core/__init__.py"),
re.MULTILINE,
).group(1)
version = _get_version()
packages = ["cfdm"]
long_description = """The **cfdm** Python package is a complete reference implementation
of the `CF data model
<https://www.geosci-model-dev.net/10/4619/2017>`_ for CF-1.11, that
identifies the fundamental elements of the `CF conventions
<http://cfconventions.org/>`_ and shows how they relate to each other,
independently of the `netCDF
<https://www.unidata.ucar.edu/software/netcdf/>`_ encoding.
The central element defined by the CF data model is the **field
construct**, which corresponds to a CF-netCDF data variable with all
of its metadata.
A simple example of reading a field construct from a file and
inspecting it:
>>> import cfdm
>>> f = cfdm.read('file.nc')
>>> f
[<Field: air_temperature(time(12), latitude(64), longitude(128)) K>]
>>> print(f[0])
Field: air_temperature (ncvar%tas)
----------------------------------
Data : air_temperature(time(12), latitude(64), longitude(128)) K
Cell methods : time(12): mean (interval: 1.0 month)
Dimension coords: time(12) = [0450-11-16 00:00:00, ..., 0451-10-16 12:00:00] noleap
: latitude(64) = [-87.8638, ..., 87.8638] degrees_north
: longitude(128) = [0.0, ..., 357.1875] degrees_east
: height(1) = [2.0] m
The **cfdm** package can
* read field and domain constructs from netCDF and CDL datasets with a choice of netCDF backends,
* be fully flexible with respect to HDF5 chunking,
* create new field and domain constructs in memory,
* write and append field and domain constructs to netCDF datasets on disk,
* read, write, and manipulate UGRID mesh topologies,
* read, write, and create coordinates defined by geometry cells,
* read and write netCDF4 string data-type variables,
* read, write, and create netCDF and CDL datasets containing hierarchical groups,
* inspect field and domain constructs,
* test whether two constructs are the same,
* modify field and domain construct metadata and data,
* create subspaces of field and domain constructs,
* incorporate, and create, metadata stored in external files, and
* read, write, and create data that have been compressed by convention
(i.e. ragged or gathered arrays, or coordinate arrays compressed
by subsampling), whilst presenting a view of the data in its
uncompressed form.
Documentation
=============
https://ncas-cms.github.io/cfdm
Tutorial
========
https://ncas-cms.github.io/cfdm/tutorial
Installation
============
https://ncas-cms.github.io/cfdm/installation
Command line utility
====================
During installation the `cfdump` command line tool is also installed,
which generates text descriptions of the field constructs contained
in a netCDF dataset.
Source code
===========
This project is hosted in a `GitHub repository
<https://github.com/NCAS-CMS/cfdm>`_ where you can access the most
up-to-date source."""
# Get dependencies
requirements = open("requirements.txt", "r")
install_requires = requirements.read().splitlines()
tests_require = (
[
"pytest",
"pycodestyle",
"coverage",
"scipy",
],
)
extras_require = {
"documentation": [
"sphinx==2.4.5",
"sphinx-copybutton",
"sphinx-toggleprompt",
"sphinxcontrib-spelling",
],
"pre-commit hooks": [
"pre-commit",
"black",
"docformatter",
"flake8",
"pydocstyle",
],
}
setup(
name="cfdm",
long_description=long_description,
long_description_content_type="text/x-rst",
version=version,
description="A Python reference implementation of the CF data model",
author="David Hassell, Sadie Bartholomew",
author_email="[email protected]",
maintainer="David Hassell, Sadie Bartholomew",
url="https://ncas-cms.github.io/cfdm",
download_url="https://pypi.org/project/cfdm/#files",
platforms=["Linux", "MacOS", "Windows"],
license="MIT",
keywords=[
"cf",
"netcdf",
"data",
"science",
"oceanography",
"meteorology",
"climate",
],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
packages=[
"cfdm",
"cfdm.abstract",
"cfdm.core",
"cfdm.core.abstract",
"cfdm.core.data",
"cfdm.core.data.abstract",
"cfdm.core.docstring",
"cfdm.core.meta",
"cfdm.core.mixin",
"cfdm.docstring",
"cfdm.data",
"cfdm.data.abstract",
"cfdm.data.mixin",
"cfdm.data.subarray",
"cfdm.data.subarray.abstract",
"cfdm.data.subarray.mixin",
"cfdm.mixin",
"cfdm.read_write",
"cfdm.read_write.abstract",
"cfdm.read_write.netcdf",
"cfdm.read_write.netcdf.flatten",
"cfdm.test",
],
scripts=["scripts/cfdump"],
python_requires=">=3.8",
install_requires=install_requires,
tests_require=tests_require,
extras_require=extras_require,
include_package_data=True,
)