Skip to main content

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.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_grid allows 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_comparison Creates 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_plot Creates 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygridsio-0.3.17.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygridsio-0.3.17-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file pygridsio-0.3.17.tar.gz.

File metadata

  • Download URL: pygridsio-0.3.17.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for pygridsio-0.3.17.tar.gz
Algorithm Hash digest
SHA256 80c4ea229ac9abcb1e7f28102338eb9d3620d89f00b423111531675c0ef7aa82
MD5 ae498a055f373a4ea9a26fe3eff6845f
BLAKE2b-256 a4618b97e9565e977c0ebec4e6eaecf42d56d8ae1e5f35aec4463c6f786f5c1d

See more details on using hashes here.

File details

Details for the file pygridsio-0.3.17-py3-none-any.whl.

File metadata

  • Download URL: pygridsio-0.3.17-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for pygridsio-0.3.17-py3-none-any.whl
Algorithm Hash digest
SHA256 58a17497cda612a5df4d3264a6bf36ae80b3d95081d74b93652ed968fd73b9f4
MD5 ac42e46fca8f5903428b4bc3643128c0
BLAKE2b-256 76c942ca6ac69f6de21205658be26a7dc874275711453fea8973fe5d2adfa01f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page