verif 1.3.0.dev1__tar.gz → 1.4.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.
- verif-1.4.0/.gitignore +16 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/LICENSE +1 -1
- verif-1.4.0/MANIFEST.in +22 -0
- verif-1.4.0/PKG-INFO +36 -0
- verif-1.4.0/README.rst +107 -0
- verif-1.4.0/makefile +40 -0
- verif-1.4.0/pyproject.toml +55 -0
- verif-1.4.0/tox.ini +15 -0
- verif-1.4.0/verif/.gitignore +2 -0
- verif-1.4.0/verif/__main__.py +6 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/aggregator.py +44 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/axis.py +1 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/data.py +237 -80
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/driver.py +32 -6
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/field.py +36 -6
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/input.py +153 -11
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/metric.py +183 -21
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/output.py +490 -115
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/util.py +15 -38
- verif-1.4.0/verif/version.py +1 -0
- verif-1.4.0/verif.egg-info/PKG-INFO +36 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/verif.egg-info/SOURCES.txt +7 -1
- {verif-1.3.0.dev1 → verif-1.4.0}/verif.egg-info/entry_points.txt +0 -1
- {verif-1.3.0.dev1 → verif-1.4.0}/verif.egg-info/requires.txt +3 -4
- verif-1.3.0.dev1/PKG-INFO +0 -166
- verif-1.3.0.dev1/README.rst +0 -139
- verif-1.3.0.dev1/setup.py +0 -114
- verif-1.3.0.dev1/verif/version.py +0 -1
- verif-1.3.0.dev1/verif.egg-info/PKG-INFO +0 -166
- {verif-1.3.0.dev1 → verif-1.4.0}/setup.cfg +0 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/__init__.py +0 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/interval.py +0 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/location.py +0 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/metric_type.py +0 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/verif/variable.py +0 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/verif.egg-info/dependency_links.txt +0 -0
- {verif-1.3.0.dev1 → verif-1.4.0}/verif.egg-info/top_level.txt +0 -0
verif-1.4.0/.gitignore
ADDED
verif-1.4.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
include pyproject.toml
|
|
2
|
+
include README.md
|
|
3
|
+
include LICENSE
|
|
4
|
+
|
|
5
|
+
recursive-include verif *.py
|
|
6
|
+
|
|
7
|
+
prune tests
|
|
8
|
+
prune docs
|
|
9
|
+
prune .github
|
|
10
|
+
prune .gitignore
|
|
11
|
+
prune scripts
|
|
12
|
+
prune examples
|
|
13
|
+
prune other
|
|
14
|
+
prune .pytest_cache
|
|
15
|
+
prune build
|
|
16
|
+
prune dist
|
|
17
|
+
prune verif/tests
|
|
18
|
+
|
|
19
|
+
global-exclude __pycache__/*
|
|
20
|
+
global-exclude *.pyc
|
|
21
|
+
global-exclude *.pyo
|
|
22
|
+
global-exclude *.pyd
|
verif-1.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: verif
|
|
3
|
+
Version: 1.4.0
|
|
4
|
+
Summary: A verification program for meteorological forecasts and observations
|
|
5
|
+
Author-email: Thomas Nipen <thomasn@met.no>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/WFRT/verif
|
|
8
|
+
Keywords: meteorology,verification,weather prediction
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
20
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: numpy>=1.7
|
|
25
|
+
Requires-Dist: matplotlib
|
|
26
|
+
Requires-Dist: scipy
|
|
27
|
+
Requires-Dist: netCDF4
|
|
28
|
+
Requires-Dist: PyQt6
|
|
29
|
+
Requires-Dist: cftime
|
|
30
|
+
Requires-Dist: cartopy
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: coverage; extra == "test"
|
|
33
|
+
Requires-Dist: pep8; extra == "test"
|
|
34
|
+
Requires-Dist: pylint; extra == "test"
|
|
35
|
+
Requires-Dist: flake8; extra == "test"
|
|
36
|
+
Dynamic: license-file
|
verif-1.4.0/README.rst
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Forecast verification software
|
|
2
|
+
==============================
|
|
3
|
+
.. image:: https://img.shields.io/github/v/release/WFRT/verif.svg
|
|
4
|
+
:target: https://github.com/WFRT/verif/releases
|
|
5
|
+
:alt: Release badge
|
|
6
|
+
.. image:: https://github.com/WFRT/verif/actions/workflows/python-package.yml/badge.svg
|
|
7
|
+
:target: https://github.com/WFRT/verif/actions/workflows/python-package.yml
|
|
8
|
+
:alt: CI badge
|
|
9
|
+
.. image:: https://img.shields.io/badge/DOI-10.1175%2FBAMS--D--22--0253.1-blue
|
|
10
|
+
:target: https://doi.org/10.1175/BAMS-D-22-0253.1
|
|
11
|
+
:alt: Bams Article
|
|
12
|
+
|
|
13
|
+
Verif is a command-line tool that lets you verify the quality of weather forecasts for point
|
|
14
|
+
locations. It can also compare forecasts from different forecasting systems (that have different
|
|
15
|
+
models, post-processing methods, etc).
|
|
16
|
+
|
|
17
|
+
The program reads files with observations and forecasts in a specific format (see "Input files"
|
|
18
|
+
below). The input files contain information about dates, forecast lead times, and locations such
|
|
19
|
+
that statistics can be aggregated across different dimensions. To ensure a fair comparison among
|
|
20
|
+
files, Verif will discard data points where one or more forecast systems have missing forecasts.
|
|
21
|
+
Since Verif is a command-line tool, it can be used in scripts to automatically create
|
|
22
|
+
verification figures.
|
|
23
|
+
|
|
24
|
+
Verif version 1.4 has been released (see "Installation Instruction" below). We welcome suggestions
|
|
25
|
+
for improvements. Verif is developed by Thomas Nipen (thomasn@met.no), with contributions from many.
|
|
26
|
+
|
|
27
|
+
Features
|
|
28
|
+
--------
|
|
29
|
+
|
|
30
|
+
* Deterministic metrics such as MAE, bias, correlation, RMSE (e.g. ``-m mae``)
|
|
31
|
+
* Threshold-based metrics such as the false alarm rate, ETS, EDI, Yule's Q (e.g. ``-m ets``)
|
|
32
|
+
* Probabilistic metrics such as brier score, PIT-histogram, reliability diagrams (e.g. ``-m bs``)
|
|
33
|
+
* Special plots like Taylor diagrams (``-m taylor``), quantile-quantile plots (``-m qq``).
|
|
34
|
+
* Plot scores as a function of date, lead time, station altitude/lat/longitude (e.g. ``-x date``)
|
|
35
|
+
* Show scores on maps (``-type map``)
|
|
36
|
+
* Subset the data by specifying a date range and lat/lon range (``-latrange 58,60``)
|
|
37
|
+
* Export to text (``-type text``)
|
|
38
|
+
* Options to adjust font sizes, label positions, tick marks, legends, etc (``-labfs 14``)
|
|
39
|
+
* Anomaly statistics relative to a baseline like climatology (``-c climfile.txt``)
|
|
40
|
+
* Output to png, jpeg, eps, etc and specify dimensions and resolution (``-f image.png -dpi 300``)
|
|
41
|
+
|
|
42
|
+
Resources
|
|
43
|
+
---------
|
|
44
|
+
|
|
45
|
+
* Check out the **wiki** at https://github.com/WFRT/verif/wiki.
|
|
46
|
+
* Found a bug? Please report it in the **issue tracker** at https://github.com/WFRT/verif/issues.
|
|
47
|
+
* Reach out to the Verif community in the **discussions** at https://github.com/WFRT/verif/discussions.
|
|
48
|
+
* Check out our `article <https://journals.ametsoc.org/view/journals/bams/104/9/BAMS-D-22-0253.1.xml>`_ published in BAMS.
|
|
49
|
+
|
|
50
|
+
.. image:: other/image.jpg
|
|
51
|
+
:alt: Example plots
|
|
52
|
+
:width: 400
|
|
53
|
+
:align: center
|
|
54
|
+
|
|
55
|
+
Getting started
|
|
56
|
+
---------------
|
|
57
|
+
|
|
58
|
+
The easiest way to get started is to install verif with pip:
|
|
59
|
+
|
|
60
|
+
.. code-block:: bash
|
|
61
|
+
|
|
62
|
+
pip3 install verif
|
|
63
|
+
|
|
64
|
+
The `verif` command-line program should then be available.
|
|
65
|
+
|
|
66
|
+
Note that the python package "cartopy" is optional and not installed by default when verif is
|
|
67
|
+
installed, Verif uses "cartopy" for creating a background map when verification scores are plotted
|
|
68
|
+
on a map. To install Cartopy run
|
|
69
|
+
|
|
70
|
+
.. code-block:: bash
|
|
71
|
+
|
|
72
|
+
pip3 install cartopy
|
|
73
|
+
|
|
74
|
+
To upgrade to a newer version of Verif, run the following:
|
|
75
|
+
|
|
76
|
+
.. code-block:: bash
|
|
77
|
+
|
|
78
|
+
pip3 install verif --upgrade
|
|
79
|
+
|
|
80
|
+
Examples
|
|
81
|
+
--------
|
|
82
|
+
To test Verif, you can download example datasets from the github
|
|
83
|
+
`discussion page <https://github.com/WFRT/verif/discussions>`_. For example, download the following two files from the wind speed dataset: `MEPS.nc <https://thredds.met.no/thredds/fileServer/metusers/thomasn/verif_datasets/short_range_wind_ens/MEPS.nc>`_ (2.5 km regional model; 557MB file size) and `IFS.nc <https://thredds.met.no/thredds/fileServer/metusers/thomasn/verif_datasets/short_range_wind_ens/IFS.nc>`_ (9 km global model by ECMWF; 419 MB file size). Then run the following
|
|
84
|
+
commands to test out the software:
|
|
85
|
+
|
|
86
|
+
.. code-block:: bash
|
|
87
|
+
|
|
88
|
+
# Shows mean absolute error as a function of lead-time
|
|
89
|
+
verif MEPS.nc IFS.nc -m mae
|
|
90
|
+
# Shows average observed and forecasted values as a function on time
|
|
91
|
+
verif MEPS.nc IFS.nc -m obsfcst -x time
|
|
92
|
+
# Shows equitable threat score as a function of threshold
|
|
93
|
+
verif MEPS.nc IFS.nc -m ets
|
|
94
|
+
# Shows a reliability diagram for a threshold of 13.9 m/s (gale force winds)
|
|
95
|
+
verif MEPS.nc IFS.nc -m reliability -r 13.9
|
|
96
|
+
# Shows Brier skill score as a function of threshold
|
|
97
|
+
verif MEPS.nc IFS.nc -m bss -x threshold
|
|
98
|
+
|
|
99
|
+
How to cite
|
|
100
|
+
-----------
|
|
101
|
+
Nipen, T. N., R. B. Stull, C. Lussana, and I. A. Seierstad, 2023: `Verif: A Weather-Prediction Verification Tool for Effective Product Development <https://journals.ametsoc.org/view/journals/bams/104/9/BAMS-D-22-0253.1.xml>`_. Bull. Amer. Meteor. Soc., 104, E1610–E1618, https://doi.org/10.1175/BAMS-D-22-0253.1.
|
|
102
|
+
|
|
103
|
+
Copyright and license
|
|
104
|
+
---------------------
|
|
105
|
+
|
|
106
|
+
Copyright © 2013-2026 UBC Weather Forecast Research Team. Verif is licensed under the 3-clause
|
|
107
|
+
BSD license. See LICENSE file.
|
verif-1.4.0/makefile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.PHONY: test other/verif.sh dist
|
|
2
|
+
|
|
3
|
+
default: nothing
|
|
4
|
+
|
|
5
|
+
nothing:
|
|
6
|
+
@ echo "This makefile does not build verif, use setup.py"
|
|
7
|
+
|
|
8
|
+
VERSION=$(shell grep __version__ verif/version.py | cut -d"=" -f2 | sed s"/ //g" | sed s"/'//g")
|
|
9
|
+
test:
|
|
10
|
+
coverage run --source verif -m unittest discover -v
|
|
11
|
+
flake8 verif --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
12
|
+
|
|
13
|
+
coverage: test
|
|
14
|
+
coverage report --precision 2
|
|
15
|
+
coverage html -d pages/coverage
|
|
16
|
+
@echo "Coverage created in pages/coverage"
|
|
17
|
+
|
|
18
|
+
# Creating distribution for pip
|
|
19
|
+
dist:
|
|
20
|
+
echo $(VERSION)
|
|
21
|
+
rm -rf dist
|
|
22
|
+
python3 -m build
|
|
23
|
+
@ echo "Next, run 'twine upload dist/*'"
|
|
24
|
+
|
|
25
|
+
clean:
|
|
26
|
+
python3 setup.py clean
|
|
27
|
+
rm -rf build/
|
|
28
|
+
find . -name '*.pyc' -delete
|
|
29
|
+
rm -rf deb_dist
|
|
30
|
+
rm -rf verif.egg-info
|
|
31
|
+
|
|
32
|
+
lint:
|
|
33
|
+
# python verif/tests/pep8_test.py
|
|
34
|
+
pylint -d C,R,W verif/*.py verif/tests/*.py
|
|
35
|
+
|
|
36
|
+
count:
|
|
37
|
+
@wc -l verif/*.py | tail -1
|
|
38
|
+
|
|
39
|
+
other/verif.sh:
|
|
40
|
+
python3 other/create_bash_completion.py > other/verif.sh
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "setuptools_scm"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "verif"
|
|
7
|
+
authors = [
|
|
8
|
+
{name = "Thomas Nipen", email = "thomasn@met.no"}
|
|
9
|
+
]
|
|
10
|
+
description='A verification program for meteorological forecasts and observations'
|
|
11
|
+
keywords=['meteorology', 'verification', 'weather prediction']
|
|
12
|
+
|
|
13
|
+
license = "BSD-3-Clause"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
|
|
17
|
+
requires-python = ">=3.9"
|
|
18
|
+
classifiers = [
|
|
19
|
+
'Intended Audience :: Science/Research',
|
|
20
|
+
'Topic :: Scientific/Engineering :: Atmospheric Science',
|
|
21
|
+
'Topic :: Scientific/Engineering :: Information Analysis',
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Programming Language :: Python :: 3.9",
|
|
25
|
+
"Programming Language :: Python :: 3.10",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
29
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
30
|
+
"Development Status :: 5 - Production/Stable",
|
|
31
|
+
]
|
|
32
|
+
dependencies = [
|
|
33
|
+
'numpy>=1.7',
|
|
34
|
+
'matplotlib',
|
|
35
|
+
'scipy',
|
|
36
|
+
'netCDF4',
|
|
37
|
+
'PyQt6',
|
|
38
|
+
'cftime',
|
|
39
|
+
'cartopy',
|
|
40
|
+
]
|
|
41
|
+
dynamic = ["version"]
|
|
42
|
+
optional-dependencies.test = ['coverage', 'pep8', 'pylint', 'flake8']
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage='https://github.com/WFRT/verif'
|
|
46
|
+
|
|
47
|
+
[tool.setuptools]
|
|
48
|
+
include-package-data = false
|
|
49
|
+
packages = ["verif"]
|
|
50
|
+
|
|
51
|
+
[tool.setuptools.dynamic]
|
|
52
|
+
version = {attr = "verif.version.__version__"}
|
|
53
|
+
|
|
54
|
+
[project.scripts]
|
|
55
|
+
verif = "verif:main"
|
verif-1.4.0/tox.ini
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[tox]
|
|
2
|
+
envlist = py37, py310
|
|
3
|
+
|
|
4
|
+
[testenv]
|
|
5
|
+
# set the matplitlib backend to one that does not require the xserver
|
|
6
|
+
setenv = MPLBACKEND = Agg
|
|
7
|
+
passenv =
|
|
8
|
+
TRAVIS
|
|
9
|
+
TRAVIS_*
|
|
10
|
+
|
|
11
|
+
deps =.[test]
|
|
12
|
+
|
|
13
|
+
commands =
|
|
14
|
+
coverage run --source verif -m unittest discover
|
|
15
|
+
verif examples/raw.txt examples/kf.txt -m mae -f test.png
|
|
@@ -145,3 +145,47 @@ class Quantile(Aggregator):
|
|
|
145
145
|
|
|
146
146
|
def __eq__(self, other):
|
|
147
147
|
return (self.__class__ == other.__class__) and (self.quantile == other.quantile)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class Change(Aggregator):
|
|
151
|
+
"""Difference between the last and the first element. Is most useful
|
|
152
|
+
when used with -Tagg since it implies an array representing a sequence
|
|
153
|
+
such as time.
|
|
154
|
+
"""
|
|
155
|
+
def __call__(self, array, axis=None):
|
|
156
|
+
if axis is None:
|
|
157
|
+
return array.flatten()[-1] - array.flatten()[0]
|
|
158
|
+
elif axis == 0:
|
|
159
|
+
return array[-1, ...] - array[0, ...]
|
|
160
|
+
elif axis == 1:
|
|
161
|
+
return array[:, -1, ...] - array[:, 0, ...]
|
|
162
|
+
elif axis == 2:
|
|
163
|
+
return array[:, :, -1, ...] - array[:, :, 0, ...]
|
|
164
|
+
elif axis == 3:
|
|
165
|
+
return array[:, :, :, -1, ...] - array[:, :, :, 0, ...]
|
|
166
|
+
elif axis == 4:
|
|
167
|
+
return array[:, :, :, :, -1, ...] - array[:, :, :, :, 0, ...]
|
|
168
|
+
else:
|
|
169
|
+
raise NotImplementedError(f"This function not implemented for axis {axis}")
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class AbsChange(Aggregator):
|
|
173
|
+
"""Absolute value of difference between the last and the first element. Is most useful
|
|
174
|
+
when used with -Tagg since it implies an array representing a sequence
|
|
175
|
+
such as time.
|
|
176
|
+
"""
|
|
177
|
+
def __call__(self, array, axis=None):
|
|
178
|
+
if axis is None:
|
|
179
|
+
return np.abs(array.flatten()[-1] - array.flatten()[0])
|
|
180
|
+
elif axis == 0:
|
|
181
|
+
return np.abs(array[-1, ...] - array[0, ...])
|
|
182
|
+
elif axis == 1:
|
|
183
|
+
return np.abs(array[:, -1, ...] - array[:, 0, ...])
|
|
184
|
+
elif axis == 2:
|
|
185
|
+
return np.abs(array[:, :, -1, ...] - array[:, :, 0, ...])
|
|
186
|
+
elif axis == 3:
|
|
187
|
+
return np.abs(array[:, :, :, -1, ...] - array[:, :, :, 0, ...])
|
|
188
|
+
elif axis == 4:
|
|
189
|
+
return np.abs(array[:, :, :, :, -1, ...] - array[:, :, :, :, 0, ...])
|
|
190
|
+
else:
|
|
191
|
+
raise NotImplementedError(f"This function not implemented for axis {axis}")
|
|
@@ -38,6 +38,7 @@ def get_leadtime_axes():
|
|
|
38
38
|
return [axis[1]() for axis in get_all() if hasattr(axis[1], "compute_from_leadtimes")]
|
|
39
39
|
return [verif.axis.Leadtime(), verif.axis.Leadtimeday()]
|
|
40
40
|
|
|
41
|
+
|
|
41
42
|
def get_spatial_axes():
|
|
42
43
|
return [axis[1]() for axis in get_all() if axis[1]().is_location_like]
|
|
43
44
|
|