This is a utility package to read in .zmap and .asc grids to numpy or xarrays
Project description
pygridsio
Introduction
This is a python submodule containing IO functionality for reading and writing .asc, .zmap .nc and .tif grids.
Installation
pygridsio is available via the pypi package registry:
pip install pygridsio
Usage
from pygridsio import *
The standard grid class used throughout this project is a Xarray DataArray (see: https://xarray.dev/) with 2 dimensions: x and y.
To read a grid file to this class use:
grid = read_grid(filename)
You can write a grid to .asc, .zmap, .nc or .tif using the following method:
write_grid(grid,filename)
The code will discern which filetype to write out to by the file extension in filename. Note: .asc and .zmap are ascii based files and take up a lot of space. .nc and .tif are binary file types.
There is some plotting functionality implemented in pygridsio, this can be accessed using the pygridsio.grid_plotting module:
- The method
pygridsio.grid_plotting.plot_gridallows you to plot a custom Grid class, or xr.DataArray with multiple options. See the description of the method for more detail. - The method
pygridsio.grid_plotting.plot_grid_comparisonCreates a plot comparing two grids values against each other. See the description of the method for more detail. - The method
pygridsio.grid_plotting.make_interactive_plotCreates a interactive .html plot using plotly, this saves to a .html file
Poetry
For developing this package further you can use the poetry pacakge manager. Install poetry here: https://python-poetry.org/docs/ (note: if you can't run poetry from your terminal, ensure that the poetry.exe is in your environment variables).
Then after cloning this repo to your local machine, run:
poetry install
Which will install a virtual environment in the gitlab repo.
Verify Installation
You can verify the installation of the different python packages by running the tests stored in tests.
In pycharm: Right-click on the folder marked tests and click on Run python tests in test
publishing the project to gitlab
First configure the connection between poetry and the gitlab package registry:
poetry config repositories.gitlab_pygridsio https://YOURGITLABLOCATION/gitlab/api/v4/projects/17422/packages/pypi
Add your own personal access token details (https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html):
poetry publish --repository gitlab_pygridsio -u"token name" -p "token value"
Then you can build and publish the project as a new deployment in the package registry:
poetry build
poetry publish
(make sure the version number you publish is unique)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygridsio-0.3.21.tar.gz.
File metadata
- Download URL: pygridsio-0.3.21.tar.gz
- Upload date:
- Size: 29.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
819ba856617638d4ae3c2d166130fe68eece901a7750bd47b2670eec89902f56
|
|
| MD5 |
a9ef1e30969cb748a92c889c0b6dab96
|
|
| BLAKE2b-256 |
ab4a8a316002f835e40ef06dabe6090833683324a939dd41797b8cb5761c0dd8
|
File details
Details for the file pygridsio-0.3.21-py3-none-any.whl.
File metadata
- Download URL: pygridsio-0.3.21-py3-none-any.whl
- Upload date:
- Size: 30.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a35522835abbfd78156917d897d5690af2f7966f7325d832cd6416cdd35403f
|
|
| MD5 |
686ecc04aa4011d83236ce4ff6c94aef
|
|
| BLAKE2b-256 |
5c1dd63e7f8d0de98a14509364058a5511e46f784e4aaaa715fc2ff6c4e8c6c7
|