Skip to content

Commit

Permalink
Merge pull request #169 from jswhit/v2.1.2rel
Browse files Browse the repository at this point in the history
prepare for v2.1.2rel
  • Loading branch information
jswhit authored Dec 22, 2020
2 parents b03b0d6 + 6427725 commit 23730b9
Show file tree
Hide file tree
Showing 31 changed files with 300 additions and 10,824 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
PROJ_LIB: /usr/share/proj
strategy:
matrix:
python-version: ["3.7", "3.8"]
python-version: ["3.6", "3.7", "3.8", "3.9"]
steps:

- uses: actions/checkout@v2
Expand All @@ -31,9 +31,11 @@ jobs:
- name: Install pygrib dependencies via pip
run: |
python -m pip install "numpy>1.10"
python -m pip install numpy
python -m pip install cython
python -m pip install "pyproj<3.0.0"
python -m pip install pyproj
python -m pip install pytest
python -m pip install pytest-mpl
python -m pip install wheel
python -m pip install pyshp
python -m pip install six
Expand All @@ -42,15 +44,19 @@ jobs:
python -m pip install cartopy
python -m pip install scipy
python -m pip install pyspharm
python -m pip install pytest pytest-mpl
- name: Install pygrib
run: |
python setup.py install
- name: Test
run: |
python test.py
cd test
#cd test
#python test.py
#python test_latlons.py
cp -r test/ /tmp
cp -r sampledata/ /tmp
cp conftest.py /tmp
cd /tmp/test
export MPLBACKEND=agg
pytest test*py --mpl --mpl-baseline-path=baseline_images
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

10 changes: 9 additions & 1 deletion Changelog
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
version 2.1.2 (not yet released)
version 2.1.2 (git tag v2.1.2rel)
================================
* use pytest-mpl for image comparison tests.
* change license to MIT.
* changes gribmessage.projparams['proj'] from 'cyl' to 'longlat'
for non-projection projections (e.g. 'regular_ll'). Issue #167.
* reorganize to include eccodes definitions inside package
when wheels are build (PYGRIB_WHEEL env var is set).
Add set_definitions_path/get_defintions_path module functions
to get/reset ECCODES_DEFINITION_PATH.
* include binary wheels for linux in pypi release.
* add grid template definition for RAP grib files in binary wheels (issue #134).
Not fully implemented, but at least file can be read (gridType=unknown, latlons
method doesn't yet work)..

version 2.1.1 (git tag v2.1.1rel)
=================================
Expand Down
5 changes: 2 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
include MANIFEST.in
include LICENSE
include pyproject.toml
include pygrib.pyx
include redtoreg.pyx
include setup.py
include .travis.yml
include test.py
include README.md
include pygrib/__init__.py
include pygrib/_pygrib.pyx
include utils/*grib*
recursive-include docs *
include sampledata/*.grb
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,23 @@ There are limited capabilities for writing GRIB files (you can modify the conten
Quickstart
==========

The easiest way to get everything installed is to use the [conda](https://conda.io):
The easiest way to get everything installed is to use [pip](https://py.pypa.io):

```
conda install -c conda-forge pygrib
pip install pygrib
```

If you don't use conda, be sure you have the ECCODES library installed first.
Then you can install pygrib with pip:
You can also use [conda](https://docs.conda.io/en/latest/):

```
ECCODES_DIR=path/to/eccodes pip install pygrib
conda install -c conda-forge pygrib
```

Alternately, clone the github repo and run `python setup.py install` (after setting `$ECCCODES_DIR`)
where `$ECCODES_DIR` is the path to the directory containing `include/grib_api.h`
and `lib/libeccodes.so`. If `ECCODES_DIR` is not specified, a few common locations
such as `$CONDA_PREFIX,/usr,/usr/local,/opt/local` will be searched.

Alternately, clone the github repo and run `python setup.py install` (after setting `$ECCCODES_DIR`).
Run `python test.py` from the source directory to test your pygrib installation.

For full installation instructions and API documentation, see https://jswhit.github.io/pygrib.

Sample [iPython](http://ipython.org/) notebooks illustrating pygrib usage:
Expand Down
Binary file modified docs/_build/doctrees/api.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/installing.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 65f4399708de4ec123415b7aaea1b846
config: 8dd736fc547b45a6a09dfaf65e8e237b
tags: 645f666f9bcd5a90fca523b33c5a78b7
20 changes: 19 additions & 1 deletion docs/_build/html/_sources/api.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ find the first grib message with a matching name:

>>> grb = grbs.select(name='Maximum temperature')[0]

extract the data values using the 'values' key grb.keys() will return a list of the available keys):
extract the data values using the ``values`` key (``grb.keys()`` will return a list of the available keys):

>>> maxt = grb.values # same as grb['values']
# The data is returned as a numpy array, or if missing values or a bitmap
Expand Down Expand Up @@ -68,6 +68,24 @@ extract data and get lat/lon values for a subset over North America:
>>> data.shape, lats.min(), lats.max(), lons.min(), lons.max()
(26, 53) 21.904439458 69.5216630593 221.25 318.75

modify the values associated with existing keys:

>>> grb['forecastTime'] = 240
>>> grb.dataDate = 20100101

get the binary string associated with the coded message:

>>> msg = grb.tostring()
>>> grbs.close() # close the grib file.

write the modified message to a new GRIB file:

>>> grbout = open('test.grb','wb')
>>> grbout.write(msg)
>>> grbout.close()
>>> pygrib.open('test.grb').readline()
1:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 240 hrs:from 201001011200

Module docstrings
-----------------

Expand Down
2 changes: 1 addition & 1 deletion docs/_build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pygrib

High-level python interface to
`ECCODES <https://confluence.ecmwf.int/display/ECC>`__ library for
reading `GRIB <https://weather.gc.ca/grib/what_is_GRIB_e.html>`__ files.
`GRIB <https://weather.gc.ca/grib/what_is_GRIB_e.html>`__ file IO.

Contents
--------
Expand Down
41 changes: 22 additions & 19 deletions docs/_build/html/_sources/installing.rst.txt
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
Installation
============

Required dependencies
---------------------
Dependencies
------------

- Python >= 2.7
- `ECCODES <https://confluence.ecmwf.int/display/ECC>`__ C library version 2.19.1 or higher.
- ECCODES_ C library.
- `numpy <http://www.numpy.org/>`__
- `pyproj <https://pyproj4.github.io/pyproj/stable>`__
- `cython <https://cython.org>`__ (only needed at build-time)


Instructions
------------

The easiest way to get everything installed is to use conda_ command line tool::

$ conda install -c conda-forge pygrib
The easiest way to get everything installed is to use pip_:

.. _conda: http://conda.io/
>>> pip install pygrib

If you don't use conda, be sure you have the required dependencies
installed first. Then, install cftime with pip::
This will install all the dependencies for you (including the ECCODES_ C lib).

$ ECCODES_DIR=path/to/eccodes pip install pygrib
If you're using Anaconda python, use conda_:

where ``$ECCODES_DIR`` is the path to the directory containing ``include/grib_api.h``
and ``lib/libeccodes.so``. If ``ECCODES_DIR`` is not specified, a few common locations
such as ``$CONDA_PREFIX,/usr,/usr/local,/opt/local`` will be searched..
>>> conda install -c conda-forge pygrib

.. _pip: http://pip.pypa.io/
.. _conda: http://conda.io/
.. _ECCODES: https://confluence.ecmwf.int/display/ECC/

Developing
----------

When developing we recommend cloning the GitHub repository,
building the extension in-place with `cython <http://cython.org/>`__ 0.19 or later
``python setup.py build_ext --inplace``
To build from source, clone the github repository and run setup.py:

>>> git clone https://github.com/jswhit/pygrib
>>> cd pygrib
>>> ECCODES_DIR=path/to/eccodes python setup.py install

and running the test script to check if the changes are passing the tests
``python test.py``
where ``$ECCODES_DIR`` is the path to the directory containing ``include/grib_api.h``
and ``lib/libeccodes.so``. If ``ECCODES_DIR`` is not specified, a few common locations
such as ``$CONDA_PREFIX,/usr,/usr/local,/opt/local`` will be searched..
Then run a test script to check if things are working
``cd test; python test.py``
Loading

0 comments on commit 23730b9

Please sign in to comment.