cfdb-vars 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cfdb_vars-0.1.0/.gitignore +119 -0
- cfdb_vars-0.1.0/LICENSE +16 -0
- cfdb_vars-0.1.0/PKG-INFO +71 -0
- cfdb_vars-0.1.0/README.md +57 -0
- cfdb_vars-0.1.0/cfdb_vars/__init__.py +52 -0
- cfdb_vars-0.1.0/cfdb_vars/coord_vars.py +92 -0
- cfdb_vars-0.1.0/cfdb_vars/data_vars.py +259 -0
- cfdb_vars-0.1.0/cfdb_vars/time_dtype_params.py +14 -0
- cfdb_vars-0.1.0/pyproject.toml +138 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
env/
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
# Usually these files are written by a python script from a template
|
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
.hypothesis/
|
|
48
|
+
.pytest_cache/
|
|
49
|
+
junit/
|
|
50
|
+
junit.xml
|
|
51
|
+
test.db
|
|
52
|
+
|
|
53
|
+
# Translations
|
|
54
|
+
*.mo
|
|
55
|
+
*.pot
|
|
56
|
+
|
|
57
|
+
# Django stuff:
|
|
58
|
+
*.log
|
|
59
|
+
local_settings.py
|
|
60
|
+
|
|
61
|
+
# Flask stuff:
|
|
62
|
+
instance/
|
|
63
|
+
.webassets-cache
|
|
64
|
+
|
|
65
|
+
# Scrapy stuff:
|
|
66
|
+
.scrapy
|
|
67
|
+
|
|
68
|
+
# Sphinx documentation
|
|
69
|
+
docs/_build/
|
|
70
|
+
|
|
71
|
+
# PyBuilder
|
|
72
|
+
target/
|
|
73
|
+
|
|
74
|
+
# Jupyter Notebook
|
|
75
|
+
.ipynb_checkpoints
|
|
76
|
+
|
|
77
|
+
# pyenv
|
|
78
|
+
.python-version
|
|
79
|
+
|
|
80
|
+
# celery beat schedule file
|
|
81
|
+
celerybeat-schedule
|
|
82
|
+
|
|
83
|
+
# SageMath parsed files
|
|
84
|
+
*.sage.py
|
|
85
|
+
|
|
86
|
+
# dotenv
|
|
87
|
+
.env
|
|
88
|
+
|
|
89
|
+
# virtualenv
|
|
90
|
+
.venv
|
|
91
|
+
venv/
|
|
92
|
+
ENV/
|
|
93
|
+
.ruff*
|
|
94
|
+
|
|
95
|
+
# Spyder project settings
|
|
96
|
+
.spyderproject
|
|
97
|
+
.spyproject
|
|
98
|
+
|
|
99
|
+
# Rope project settings
|
|
100
|
+
.ropeproject
|
|
101
|
+
|
|
102
|
+
# mkdocs documentation
|
|
103
|
+
/site
|
|
104
|
+
|
|
105
|
+
# mypy
|
|
106
|
+
.mypy_cache/
|
|
107
|
+
|
|
108
|
+
# .vscode
|
|
109
|
+
.vscode/
|
|
110
|
+
|
|
111
|
+
# OS files
|
|
112
|
+
.DS_Store
|
|
113
|
+
|
|
114
|
+
# Temp data
|
|
115
|
+
data/*
|
|
116
|
+
|
|
117
|
+
# Test config files
|
|
118
|
+
/cfdb_vars/tests/*.toml
|
|
119
|
+
/cfdb_vars/tests/*.yml
|
cfdb_vars-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Apache Software License 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Mike Kittridge
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
cfdb_vars-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cfdb-vars
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: variable definitions for cfdb
|
|
5
|
+
Project-URL: Documentation, https://mullenkamp.github.io/cfdb-vars/
|
|
6
|
+
Project-URL: Source, https://github.com/mullenkamp/cfdb-vars
|
|
7
|
+
Author-email: mullenkamp <mullenkamp1@gmail.com>
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Requires-Dist: cfdb-models
|
|
12
|
+
Requires-Dist: msgspec
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# cfdb-vars
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<em>variable definitions for cfdb</em>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
[](https://github.com/mullenkamp/cfdb-vars/actions)
|
|
22
|
+
[](https://codecov.io/gh/mullenkamp/cfdb-vars)
|
|
23
|
+
[](https://badge.fury.io/py/cfdb-vars)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
**Source Code**: <a href="https://github.com/mullenkamp/cfdb-vars" target="_blank">https://github.com/mullenkamp/cfdb-vars</a>
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
## Overview
|
|
31
|
+
The purpose of this package is to separate the variable metadata from the main cfdb package so that additional variables can be added without updating the version of the cfdb package. This package will have the data model for variables defined in msgspec and the variable data defined in python files (one initially).
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Development
|
|
35
|
+
|
|
36
|
+
### Setup environment
|
|
37
|
+
|
|
38
|
+
We use [UV](https://docs.astral.sh/uv/) to manage the development environment and production build.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uv sync
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Run unit tests
|
|
45
|
+
|
|
46
|
+
You can run all the tests with:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uv run pytest
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Format the code
|
|
53
|
+
|
|
54
|
+
Execute the following commands to apply linting and check typing:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
uv run ruff check .
|
|
58
|
+
uv run black --check --diff .
|
|
59
|
+
uv run mypy --install-types --non-interactive cfdb_vars
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
To auto-format:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
uv run black .
|
|
66
|
+
uv run ruff check --fix .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
This project is licensed under the terms of the Apache Software License 2.0.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# cfdb-vars
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<em>variable definitions for cfdb</em>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
[](https://github.com/mullenkamp/cfdb-vars/actions)
|
|
8
|
+
[](https://codecov.io/gh/mullenkamp/cfdb-vars)
|
|
9
|
+
[](https://badge.fury.io/py/cfdb-vars)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
**Source Code**: <a href="https://github.com/mullenkamp/cfdb-vars" target="_blank">https://github.com/mullenkamp/cfdb-vars</a>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
## Overview
|
|
17
|
+
The purpose of this package is to separate the variable metadata from the main cfdb package so that additional variables can be added without updating the version of the cfdb package. This package will have the data model for variables defined in msgspec and the variable data defined in python files (one initially).
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Development
|
|
21
|
+
|
|
22
|
+
### Setup environment
|
|
23
|
+
|
|
24
|
+
We use [UV](https://docs.astral.sh/uv/) to manage the development environment and production build.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
uv sync
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Run unit tests
|
|
31
|
+
|
|
32
|
+
You can run all the tests with:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uv run pytest
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Format the code
|
|
39
|
+
|
|
40
|
+
Execute the following commands to apply linting and check typing:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
uv run ruff check .
|
|
44
|
+
uv run black --check --diff .
|
|
45
|
+
uv run mypy --install-types --non-interactive cfdb_vars
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
To auto-format:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
uv run black .
|
|
52
|
+
uv run ruff check --fix .
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
This project is licensed under the terms of the Apache Software License 2.0.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Variable definitions for cfdb."""
|
|
2
|
+
|
|
3
|
+
from cfdb_vars.coord_vars import coord_var_defs
|
|
4
|
+
from cfdb_vars.data_vars import data_var_defs
|
|
5
|
+
from cfdb_vars.time_dtype_params import time_dtype_params as time_dtype_params
|
|
6
|
+
|
|
7
|
+
__version__ = '0.1.0'
|
|
8
|
+
|
|
9
|
+
var_defs = {**coord_var_defs, **data_var_defs}
|
|
10
|
+
|
|
11
|
+
short_name_map = {
|
|
12
|
+
'lon': 'longitude',
|
|
13
|
+
'lat': 'latitude',
|
|
14
|
+
'height': 'height',
|
|
15
|
+
'altitude': 'altitude',
|
|
16
|
+
'time': 'time',
|
|
17
|
+
'x': 'x',
|
|
18
|
+
'y': 'y',
|
|
19
|
+
'point': 'point',
|
|
20
|
+
'line': 'line',
|
|
21
|
+
'polygon': 'polygon',
|
|
22
|
+
'modified_date': 'modified_date',
|
|
23
|
+
'band': 'band',
|
|
24
|
+
'censor_code': 'censor_code',
|
|
25
|
+
'precip': 'precipitation',
|
|
26
|
+
'air_temp': 'air_temperature',
|
|
27
|
+
'wind_speed': 'wind_speed',
|
|
28
|
+
'wind_direction': 'wind_direction',
|
|
29
|
+
'u_wind': 'u_wind',
|
|
30
|
+
'v_wind': 'v_wind',
|
|
31
|
+
'relative_humidity': 'relative_humidity',
|
|
32
|
+
'dew_temp': 'dew_point_temperature',
|
|
33
|
+
'soil_temp': 'soil_temperature',
|
|
34
|
+
'lwe_soil_moisture': 'lwe_soil_moisture',
|
|
35
|
+
'surface_pressure': 'surface_pressure',
|
|
36
|
+
'specific_humidity': 'specific_humidity',
|
|
37
|
+
'mixing_ratio': 'mixing_ratio',
|
|
38
|
+
'shortwave_radiation': 'shortwave_radiation',
|
|
39
|
+
'longwave_radiation': 'longwave_radiation',
|
|
40
|
+
'snow_depth': 'snow_depth',
|
|
41
|
+
'mslp': 'mslp',
|
|
42
|
+
'vorticity': 'vorticity',
|
|
43
|
+
'vertical_velocity': 'vertical_velocity',
|
|
44
|
+
'sensible_heat_flux': 'sensible_heat_flux',
|
|
45
|
+
'moisture_flux': 'moisture_flux',
|
|
46
|
+
'albedo': 'albedo',
|
|
47
|
+
'emissivity': 'emissivity',
|
|
48
|
+
'terrain_height': 'terrain_height',
|
|
49
|
+
'potential_temperature': 'potential_temperature',
|
|
50
|
+
'equivalent_potential_temperature': 'equivalent_potential_temperature',
|
|
51
|
+
'land_use_modis': 'land_use_modis',
|
|
52
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Coordinate variable definitions for cfdb."""
|
|
2
|
+
|
|
3
|
+
from cfdb_models.data_models import CoordVarDef, DataType
|
|
4
|
+
|
|
5
|
+
coord_var_defs = {
|
|
6
|
+
'longitude': CoordVarDef(
|
|
7
|
+
dtype=DataType(name='float64', precision=6, dtype_encoded='uint32', offset=-180.000001, fillvalue=0),
|
|
8
|
+
attrs={
|
|
9
|
+
'long_name': 'longitude',
|
|
10
|
+
'units': 'degrees_east',
|
|
11
|
+
'standard_name': 'longitude',
|
|
12
|
+
'axis': 'X',
|
|
13
|
+
'odm2_variable_name': 'longitude',
|
|
14
|
+
},
|
|
15
|
+
),
|
|
16
|
+
'latitude': CoordVarDef(
|
|
17
|
+
dtype=DataType(name='float64', precision=6, dtype_encoded='uint32', offset=-90.000001, fillvalue=0),
|
|
18
|
+
attrs={
|
|
19
|
+
'long_name': 'latitude',
|
|
20
|
+
'units': 'degrees_north',
|
|
21
|
+
'standard_name': 'latitude',
|
|
22
|
+
'axis': 'Y',
|
|
23
|
+
'odm2_variable_name': 'latitude',
|
|
24
|
+
},
|
|
25
|
+
),
|
|
26
|
+
'height': CoordVarDef(
|
|
27
|
+
dtype=DataType(name='float64', precision=3, dtype_encoded='uint32', offset=-1, fillvalue=0),
|
|
28
|
+
attrs={
|
|
29
|
+
'long_name': 'height',
|
|
30
|
+
'units': 'm',
|
|
31
|
+
'standard_name': 'height',
|
|
32
|
+
'positive': 'up',
|
|
33
|
+
'axis': 'Z',
|
|
34
|
+
'odm2_variable_name': 'height',
|
|
35
|
+
},
|
|
36
|
+
),
|
|
37
|
+
'altitude': CoordVarDef(
|
|
38
|
+
dtype=DataType(name='float64', precision=3, dtype_encoded='uint32', offset=-11000.001, fillvalue=0),
|
|
39
|
+
attrs={
|
|
40
|
+
'long_name': 'altitude',
|
|
41
|
+
'units': 'm',
|
|
42
|
+
'standard_name': 'altitude',
|
|
43
|
+
'positive': 'up',
|
|
44
|
+
'axis': 'Z',
|
|
45
|
+
'odm2_variable_name': 'altitude',
|
|
46
|
+
},
|
|
47
|
+
),
|
|
48
|
+
'time': CoordVarDef(
|
|
49
|
+
dtype=DataType(name='datetime64[m]', dtype_encoded='int32', offset=-36816481),
|
|
50
|
+
attrs={
|
|
51
|
+
'long_name': 'time',
|
|
52
|
+
'standard_name': 'time',
|
|
53
|
+
'axis': 'T',
|
|
54
|
+
},
|
|
55
|
+
),
|
|
56
|
+
'x': CoordVarDef(
|
|
57
|
+
dtype=DataType(name='float32', precision=1),
|
|
58
|
+
attrs={
|
|
59
|
+
'long_name': 'x coordinate of projection',
|
|
60
|
+
'units': 'metres',
|
|
61
|
+
'standard_name': 'projection_x_coordinate',
|
|
62
|
+
'axis': 'X',
|
|
63
|
+
},
|
|
64
|
+
),
|
|
65
|
+
'y': CoordVarDef(
|
|
66
|
+
dtype=DataType(name='float32', precision=1),
|
|
67
|
+
attrs={
|
|
68
|
+
'long_name': 'y coordinate of projection',
|
|
69
|
+
'units': 'metres',
|
|
70
|
+
'standard_name': 'projection_y_coordinate',
|
|
71
|
+
'axis': 'Y',
|
|
72
|
+
},
|
|
73
|
+
),
|
|
74
|
+
'point': CoordVarDef(
|
|
75
|
+
dtype=DataType(name='point', precision=5),
|
|
76
|
+
attrs={
|
|
77
|
+
'long_name': 'location geometry as points',
|
|
78
|
+
},
|
|
79
|
+
),
|
|
80
|
+
'line': CoordVarDef(
|
|
81
|
+
dtype=DataType(name='line', precision=5),
|
|
82
|
+
attrs={
|
|
83
|
+
'long_name': 'location geometry as lines',
|
|
84
|
+
},
|
|
85
|
+
),
|
|
86
|
+
'polygon': CoordVarDef(
|
|
87
|
+
dtype=DataType(name='polygon', precision=5),
|
|
88
|
+
attrs={
|
|
89
|
+
'long_name': 'location geometry as polygons',
|
|
90
|
+
},
|
|
91
|
+
),
|
|
92
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"""Data variable definitions for cfdb."""
|
|
2
|
+
|
|
3
|
+
from cfdb_models.data_models import DataType, DataVarDef
|
|
4
|
+
|
|
5
|
+
data_var_defs = {
|
|
6
|
+
'modified_date': DataVarDef(
|
|
7
|
+
dtype=DataType(name='datetime64[us]', dtype_encoded='int64', offset=1756684800000000),
|
|
8
|
+
attrs={
|
|
9
|
+
'long_name': 'last modified date',
|
|
10
|
+
},
|
|
11
|
+
),
|
|
12
|
+
'band': DataVarDef(
|
|
13
|
+
dtype=DataType(name='uint8'),
|
|
14
|
+
attrs={
|
|
15
|
+
'long_name': 'band number',
|
|
16
|
+
},
|
|
17
|
+
),
|
|
18
|
+
'censor_code': DataVarDef(
|
|
19
|
+
dtype=DataType(name='uint8'),
|
|
20
|
+
attrs={
|
|
21
|
+
'long_name': 'data censor code',
|
|
22
|
+
'standard_name': 'status_flag',
|
|
23
|
+
'flag_values': '0 1 2 3 4 5',
|
|
24
|
+
'flag_meanings': 'greater_than less_than not_censored non-detect present_but_not_quantified unknown',
|
|
25
|
+
},
|
|
26
|
+
),
|
|
27
|
+
'precipitation': DataVarDef(
|
|
28
|
+
dtype=DataType(name='float32', precision=2, dtype_encoded='uint16', offset=-1, fillvalue=0),
|
|
29
|
+
attrs={
|
|
30
|
+
'long_name': 'precipitation',
|
|
31
|
+
'units': 'mm',
|
|
32
|
+
'standard_name': 'precipitation_amount',
|
|
33
|
+
'odm2_variable_name': 'precipitation',
|
|
34
|
+
},
|
|
35
|
+
),
|
|
36
|
+
'air_temperature': DataVarDef(
|
|
37
|
+
dtype=DataType(name='float32', precision=2, dtype_encoded='uint16', offset=-61, fillvalue=0),
|
|
38
|
+
attrs={
|
|
39
|
+
'long_name': 'air temperature',
|
|
40
|
+
'units': 'K',
|
|
41
|
+
'standard_name': 'air_temperature',
|
|
42
|
+
},
|
|
43
|
+
),
|
|
44
|
+
'wind_speed': DataVarDef(
|
|
45
|
+
dtype=DataType(name='float32', precision=2, dtype_encoded='uint16', offset=-1, fillvalue=0),
|
|
46
|
+
attrs={
|
|
47
|
+
'long_name': 'wind speed',
|
|
48
|
+
'units': 'm/s',
|
|
49
|
+
'standard_name': 'wind_speed',
|
|
50
|
+
'odm2_variable_name': 'windSpeed',
|
|
51
|
+
},
|
|
52
|
+
),
|
|
53
|
+
'wind_direction': DataVarDef(
|
|
54
|
+
dtype=DataType(name='float32', precision=1, dtype_encoded='uint16', offset=-1, fillvalue=0),
|
|
55
|
+
attrs={
|
|
56
|
+
'long_name': 'wind direction',
|
|
57
|
+
'units': 'deg',
|
|
58
|
+
'standard_name': 'wind_to_direction',
|
|
59
|
+
'odm2_variable_name': 'windDirection',
|
|
60
|
+
},
|
|
61
|
+
),
|
|
62
|
+
'u_wind': DataVarDef(
|
|
63
|
+
dtype=DataType(name='float32', precision=2, dtype_encoded='uint16', offset=-101, fillvalue=0),
|
|
64
|
+
attrs={
|
|
65
|
+
'long_name': 'eastward wind component',
|
|
66
|
+
'units': 'm/s',
|
|
67
|
+
'standard_name': 'eastward_wind',
|
|
68
|
+
},
|
|
69
|
+
),
|
|
70
|
+
'v_wind': DataVarDef(
|
|
71
|
+
dtype=DataType(name='float32', precision=2, dtype_encoded='uint16', offset=-101, fillvalue=0),
|
|
72
|
+
attrs={
|
|
73
|
+
'long_name': 'northward wind component',
|
|
74
|
+
'units': 'm/s',
|
|
75
|
+
'standard_name': 'northward_wind',
|
|
76
|
+
},
|
|
77
|
+
),
|
|
78
|
+
'relative_humidity': DataVarDef(
|
|
79
|
+
dtype=DataType(name='float32', precision=1, dtype_encoded='uint16', offset=-1, fillvalue=0),
|
|
80
|
+
attrs={
|
|
81
|
+
'long_name': 'relative humidity',
|
|
82
|
+
'units': 'm^3/m^3',
|
|
83
|
+
'standard_name': 'relative_humidity',
|
|
84
|
+
'odm2_variable_name': 'relativeHumidity',
|
|
85
|
+
},
|
|
86
|
+
),
|
|
87
|
+
'dew_point_temperature': DataVarDef(
|
|
88
|
+
dtype=DataType(name='float32', precision=2, dtype_encoded='uint16', offset=-61, fillvalue=0),
|
|
89
|
+
attrs={
|
|
90
|
+
'long_name': 'dew point temperature',
|
|
91
|
+
'units': 'K',
|
|
92
|
+
'standard_name': 'dew_point_temperature',
|
|
93
|
+
'odm2_variable_name': 'temperatureDewPoint',
|
|
94
|
+
},
|
|
95
|
+
),
|
|
96
|
+
'soil_temperature': DataVarDef(
|
|
97
|
+
dtype=DataType(name='float32', precision=2, dtype_encoded='uint16', offset=-61, fillvalue=0),
|
|
98
|
+
attrs={
|
|
99
|
+
'long_name': 'soil temperature',
|
|
100
|
+
'units': 'K',
|
|
101
|
+
'standard_name': 'soil_temperature',
|
|
102
|
+
},
|
|
103
|
+
),
|
|
104
|
+
'lwe_soil_moisture': DataVarDef(
|
|
105
|
+
dtype=DataType(name='float32', precision=1, dtype_encoded='uint16', offset=-1, fillvalue=0),
|
|
106
|
+
attrs={
|
|
107
|
+
'long_name': 'liquid water equivalent of soil moisture',
|
|
108
|
+
'units': 'mm',
|
|
109
|
+
'standard_name': 'lwe_thickness_of_soil_moisture_content',
|
|
110
|
+
},
|
|
111
|
+
),
|
|
112
|
+
'surface_pressure': DataVarDef(
|
|
113
|
+
dtype=DataType(name='float32', precision=1, dtype_encoded='uint32', offset=-1, fillvalue=0),
|
|
114
|
+
attrs={
|
|
115
|
+
'long_name': 'surface pressure',
|
|
116
|
+
'units': 'Pa',
|
|
117
|
+
'standard_name': 'surface_air_pressure',
|
|
118
|
+
},
|
|
119
|
+
),
|
|
120
|
+
'specific_humidity': DataVarDef(
|
|
121
|
+
dtype=DataType(name='float32', precision=6, dtype_encoded='uint16', offset=-0.000001, fillvalue=0),
|
|
122
|
+
attrs={
|
|
123
|
+
'long_name': 'specific humidity',
|
|
124
|
+
'units': 'kg kg-1',
|
|
125
|
+
'standard_name': 'specific_humidity',
|
|
126
|
+
},
|
|
127
|
+
),
|
|
128
|
+
'mixing_ratio': DataVarDef(
|
|
129
|
+
dtype=DataType(name='float32', precision=6, dtype_encoded='uint16', offset=-0.000001, fillvalue=0),
|
|
130
|
+
attrs={
|
|
131
|
+
'long_name': 'water vapor mixing ratio',
|
|
132
|
+
'units': 'kg kg-1',
|
|
133
|
+
'standard_name': 'humidity_mixing_ratio',
|
|
134
|
+
},
|
|
135
|
+
),
|
|
136
|
+
'shortwave_radiation': DataVarDef(
|
|
137
|
+
dtype=DataType(name='float32', precision=1, dtype_encoded='uint16', offset=-1, fillvalue=0),
|
|
138
|
+
attrs={
|
|
139
|
+
'long_name': 'downward shortwave radiation at surface',
|
|
140
|
+
'units': 'W m-2',
|
|
141
|
+
'standard_name': 'surface_downwelling_shortwave_flux_in_air',
|
|
142
|
+
'odm2_variable_name': 'radiationIncomingShortwave',
|
|
143
|
+
},
|
|
144
|
+
),
|
|
145
|
+
'longwave_radiation': DataVarDef(
|
|
146
|
+
dtype=DataType(name='float32', precision=1, dtype_encoded='uint16', offset=-1, fillvalue=0),
|
|
147
|
+
attrs={
|
|
148
|
+
'long_name': 'downward longwave radiation at surface',
|
|
149
|
+
'units': 'W m-2',
|
|
150
|
+
'standard_name': 'surface_downwelling_longwave_flux_in_air',
|
|
151
|
+
'odm2_variable_name': 'radiationIncomingLongwave',
|
|
152
|
+
},
|
|
153
|
+
),
|
|
154
|
+
'snow_depth': DataVarDef(
|
|
155
|
+
dtype=DataType(name='float32', precision=3, dtype_encoded='uint16', offset=-0.001, fillvalue=0),
|
|
156
|
+
attrs={
|
|
157
|
+
'long_name': 'physical snow depth',
|
|
158
|
+
'units': 'm',
|
|
159
|
+
'standard_name': 'surface_snow_thickness',
|
|
160
|
+
'odm2_variable_name': 'snowDepth',
|
|
161
|
+
},
|
|
162
|
+
),
|
|
163
|
+
'mslp': DataVarDef(
|
|
164
|
+
dtype=DataType(name='float32', precision=1, dtype_encoded='uint32', offset=-1, fillvalue=0),
|
|
165
|
+
attrs={
|
|
166
|
+
'long_name': 'mean sea level pressure',
|
|
167
|
+
'units': 'Pa',
|
|
168
|
+
'standard_name': 'air_pressure_at_mean_sea_level',
|
|
169
|
+
},
|
|
170
|
+
),
|
|
171
|
+
'vorticity': DataVarDef(
|
|
172
|
+
dtype=DataType(name='float32', precision=5, dtype_encoded='uint16', offset=-0.300001, fillvalue=0),
|
|
173
|
+
attrs={
|
|
174
|
+
'long_name': 'relative vorticity',
|
|
175
|
+
'units': 's-1',
|
|
176
|
+
'standard_name': 'atmosphere_relative_vorticity',
|
|
177
|
+
},
|
|
178
|
+
),
|
|
179
|
+
'vertical_velocity': DataVarDef(
|
|
180
|
+
dtype=DataType(name='float32', precision=2, dtype_encoded='uint16', offset=-50.01, fillvalue=0),
|
|
181
|
+
attrs={
|
|
182
|
+
'long_name': 'vertical velocity',
|
|
183
|
+
'units': 'm s-1',
|
|
184
|
+
'standard_name': 'upward_air_velocity',
|
|
185
|
+
},
|
|
186
|
+
),
|
|
187
|
+
'sensible_heat_flux': DataVarDef(
|
|
188
|
+
dtype=DataType(name='float32', precision=1, dtype_encoded='uint16', offset=-300.1, fillvalue=0),
|
|
189
|
+
attrs={
|
|
190
|
+
'long_name': 'upward sensible heat flux',
|
|
191
|
+
'units': 'W m-2',
|
|
192
|
+
'standard_name': 'surface_upward_sensible_heat_flux',
|
|
193
|
+
'odm2_variable_name': 'sensibleHeatFlux',
|
|
194
|
+
},
|
|
195
|
+
),
|
|
196
|
+
'moisture_flux': DataVarDef(
|
|
197
|
+
dtype=DataType(name='float32', precision=6, dtype_encoded='uint16', offset=-0.010001, fillvalue=0),
|
|
198
|
+
attrs={
|
|
199
|
+
'long_name': 'upward moisture flux',
|
|
200
|
+
'units': 'kg m-2 s-1',
|
|
201
|
+
'standard_name': 'water_evapotranspiration_flux',
|
|
202
|
+
},
|
|
203
|
+
),
|
|
204
|
+
'albedo': DataVarDef(
|
|
205
|
+
dtype=DataType(name='float32', precision=3, dtype_encoded='uint16', offset=-0.001, fillvalue=0),
|
|
206
|
+
attrs={
|
|
207
|
+
'long_name': 'surface albedo',
|
|
208
|
+
'units': '1',
|
|
209
|
+
'standard_name': 'surface_albedo',
|
|
210
|
+
'odm2_variable_name': 'albedo',
|
|
211
|
+
},
|
|
212
|
+
),
|
|
213
|
+
'emissivity': DataVarDef(
|
|
214
|
+
dtype=DataType(name='float32', precision=3, dtype_encoded='uint16', offset=-0.001, fillvalue=0),
|
|
215
|
+
attrs={
|
|
216
|
+
'long_name': 'surface emissivity',
|
|
217
|
+
'units': '1',
|
|
218
|
+
'standard_name': 'surface_longwave_emissivity',
|
|
219
|
+
},
|
|
220
|
+
),
|
|
221
|
+
'terrain_height': DataVarDef(
|
|
222
|
+
dtype=DataType(name='float32', precision=1, dtype_encoded='uint16', offset=-1, fillvalue=0),
|
|
223
|
+
attrs={
|
|
224
|
+
'long_name': 'terrain height above sea level',
|
|
225
|
+
'units': 'm',
|
|
226
|
+
'standard_name': 'surface_altitude',
|
|
227
|
+
},
|
|
228
|
+
),
|
|
229
|
+
'potential_temperature': DataVarDef(
|
|
230
|
+
dtype=DataType(name='float32', precision=2, dtype_encoded='uint16', offset=-61, fillvalue=0),
|
|
231
|
+
attrs={
|
|
232
|
+
'long_name': 'air potential temperature',
|
|
233
|
+
'units': 'K',
|
|
234
|
+
'standard_name': 'air_potential_temperature',
|
|
235
|
+
},
|
|
236
|
+
),
|
|
237
|
+
'equivalent_potential_temperature': DataVarDef(
|
|
238
|
+
dtype=DataType(name='float32', precision=2, dtype_encoded='uint16', offset=-61, fillvalue=0),
|
|
239
|
+
attrs={
|
|
240
|
+
'long_name': 'equivalent potential temperature',
|
|
241
|
+
'units': 'K',
|
|
242
|
+
'standard_name': 'equivalent_potential_temperature',
|
|
243
|
+
},
|
|
244
|
+
),
|
|
245
|
+
'land_use_modis': DataVarDef(
|
|
246
|
+
dtype=DataType(name='uint8'),
|
|
247
|
+
attrs={
|
|
248
|
+
'long_name': 'land use category for modis',
|
|
249
|
+
'flag_values': '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21',
|
|
250
|
+
'flag_meanings': (
|
|
251
|
+
'evergreen_needleleaf_forests evergreen_broadleaf_forests deciduous_needleleaf_forests'
|
|
252
|
+
' deciduous_broadleaf_forests mixed_forests closed_shrublands open_shrublands woody_savannas'
|
|
253
|
+
' savannas grasslands permanent_wetlands croplands urban_and_built_up'
|
|
254
|
+
' cropland_natural_vegetation_mosaics permanent_snow_and_ice barren water_bodies wooded_tundra'
|
|
255
|
+
' mixed_tundra barren_tundra lakes'
|
|
256
|
+
),
|
|
257
|
+
},
|
|
258
|
+
),
|
|
259
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Time-resolution DataType definitions for datetime64 encoding."""
|
|
2
|
+
|
|
3
|
+
from cfdb_models.data_models import DataType
|
|
4
|
+
|
|
5
|
+
time_dtype_params = {
|
|
6
|
+
'datetime64[M]': DataType(name='datetime64[M]', dtype_encoded='int16', offset=-841),
|
|
7
|
+
'datetime64[D]': DataType(name='datetime64[D]', dtype_encoded='int32', offset=-25568),
|
|
8
|
+
'datetime64[h]': DataType(name='datetime64[h]', dtype_encoded='int32', offset=-613609),
|
|
9
|
+
'datetime64[m]': DataType(name='datetime64[m]', dtype_encoded='int32', offset=-36816481),
|
|
10
|
+
'datetime64[s]': DataType(name='datetime64[s]', dtype_encoded='int64', offset=-2208988801),
|
|
11
|
+
'datetime64[ms]': DataType(name='datetime64[ms]', dtype_encoded='int64', offset=-2208988800001),
|
|
12
|
+
'datetime64[us]': DataType(name='datetime64[us]', dtype_encoded='int64', offset=-2208988800000001),
|
|
13
|
+
'datetime64[ns]': DataType(name='datetime64[ns]', dtype_encoded='int64', offset=-631152000000000001),
|
|
14
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "cfdb-vars"
|
|
3
|
+
authors = [
|
|
4
|
+
{ name = "mullenkamp", email = "mullenkamp1@gmail.com" }
|
|
5
|
+
]
|
|
6
|
+
description = "variable definitions for cfdb"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
dynamic = ["version"]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
11
|
+
]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"cfdb-models",
|
|
15
|
+
"msgspec",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[dependency-groups]
|
|
19
|
+
dev = [
|
|
20
|
+
"spyder-kernels==2.5.2",
|
|
21
|
+
"black",
|
|
22
|
+
"mypy",
|
|
23
|
+
"ruff",
|
|
24
|
+
"pytest",
|
|
25
|
+
"pytest-cov",
|
|
26
|
+
"mkdocs-material",
|
|
27
|
+
"mkdocstrings[python]",
|
|
28
|
+
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[tool.pytest.ini_options]
|
|
32
|
+
testpaths = ["cfdb_vars/tests"]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
[tool.hatch]
|
|
36
|
+
|
|
37
|
+
[tool.hatch.metadata]
|
|
38
|
+
allow-direct-references = true
|
|
39
|
+
|
|
40
|
+
[tool.black]
|
|
41
|
+
target-version = ["py310"]
|
|
42
|
+
line-length = 120
|
|
43
|
+
skip-string-normalization = true
|
|
44
|
+
|
|
45
|
+
[tool.ruff]
|
|
46
|
+
target-version = "py310"
|
|
47
|
+
line-length = 120
|
|
48
|
+
|
|
49
|
+
[tool.ruff.lint]
|
|
50
|
+
select = [
|
|
51
|
+
"A",
|
|
52
|
+
"ARG",
|
|
53
|
+
"B",
|
|
54
|
+
"C",
|
|
55
|
+
"DTZ",
|
|
56
|
+
"E",
|
|
57
|
+
"EM",
|
|
58
|
+
"F",
|
|
59
|
+
"FBT",
|
|
60
|
+
"I",
|
|
61
|
+
"ICN",
|
|
62
|
+
"ISC",
|
|
63
|
+
"N",
|
|
64
|
+
"PLC",
|
|
65
|
+
"PLE",
|
|
66
|
+
"PLR",
|
|
67
|
+
"PLW",
|
|
68
|
+
"Q",
|
|
69
|
+
"RUF",
|
|
70
|
+
"S",
|
|
71
|
+
"T",
|
|
72
|
+
"TID",
|
|
73
|
+
"UP",
|
|
74
|
+
"W",
|
|
75
|
+
"YTT",
|
|
76
|
+
]
|
|
77
|
+
ignore = [
|
|
78
|
+
# Allow non-abstract empty methods in abstract base classes
|
|
79
|
+
"B027",
|
|
80
|
+
# Allow boolean positional values in function calls, like `dict.get(... True)`
|
|
81
|
+
"FBT003",
|
|
82
|
+
# Ignore checks for possible passwords
|
|
83
|
+
"S105", "S106", "S107",
|
|
84
|
+
# Ignore complexity
|
|
85
|
+
"C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
|
|
86
|
+
]
|
|
87
|
+
unfixable = [
|
|
88
|
+
# Don't touch unused imports
|
|
89
|
+
"F401",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
[tool.ruff.lint.isort]
|
|
93
|
+
known-first-party = ["cfdb_vars"]
|
|
94
|
+
|
|
95
|
+
[tool.ruff.lint.flake8-quotes]
|
|
96
|
+
inline-quotes = "single"
|
|
97
|
+
|
|
98
|
+
[tool.ruff.lint.flake8-tidy-imports]
|
|
99
|
+
ban-relative-imports = "all"
|
|
100
|
+
|
|
101
|
+
[tool.ruff.lint.per-file-ignores]
|
|
102
|
+
# Tests can use magic values, assertions, and relative imports
|
|
103
|
+
"cfdb_vars/tests/**/*" = ["PLR2004", "S101", "TID252"]
|
|
104
|
+
|
|
105
|
+
[tool.coverage.run]
|
|
106
|
+
source_pkgs = ["cfdb_vars", "tests"]
|
|
107
|
+
branch = true
|
|
108
|
+
parallel = true
|
|
109
|
+
|
|
110
|
+
[tool.coverage.paths]
|
|
111
|
+
cfdb_vars = ["cfdb_vars"]
|
|
112
|
+
tests = ["cfdb_vars/tests"]
|
|
113
|
+
|
|
114
|
+
[tool.coverage.report]
|
|
115
|
+
exclude_lines = [
|
|
116
|
+
"no cov",
|
|
117
|
+
"if __name__ == .__main__.:",
|
|
118
|
+
"if TYPE_CHECKING:",
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
[build-system]
|
|
122
|
+
requires = ["hatchling>=1.26.1"]
|
|
123
|
+
build-backend = "hatchling.build"
|
|
124
|
+
|
|
125
|
+
[project.urls]
|
|
126
|
+
Documentation = "https://mullenkamp.github.io/cfdb-vars/"
|
|
127
|
+
Source = "https://github.com/mullenkamp/cfdb-vars"
|
|
128
|
+
|
|
129
|
+
[tool.hatch.build.targets.sdist]
|
|
130
|
+
include = [
|
|
131
|
+
"/cfdb_vars",
|
|
132
|
+
]
|
|
133
|
+
exclude = [
|
|
134
|
+
"/cfdb_vars/tests/*",
|
|
135
|
+
]
|
|
136
|
+
|
|
137
|
+
[tool.hatch.version]
|
|
138
|
+
path = "cfdb_vars/__init__.py"
|