pygridsio


Namepygridsio JSON
Version 0.3.10 PyPI version JSON
download
home_pageNone
Summaryio utilities for reading in .asc and .zmap grids
upload_time2025-02-26 08:40:26
maintainerNone
docs_urlNone
authorBrett
requires_python<4.0,>=3.11
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pygridsio



## Introduction

This is a python submodule containing IO functionality for reading and writing .asc, .zmap and .nc grids.

## Usage

`from pygridsio.pygridsio import *`
The standard grid class used throughout this project is an 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)`


When writing out grids, you can write out grids to a netcdf raster (.nc) which can be read easily by xarray, or QGIS or ArcGIS, .asc and .zmap are also supported:
`write_grid(grid,filename)`
The code will discern which filetype to write out to by the file extension in filename.


There is some plotting functionality built into pygridsio 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 eachother. See the description of the method for more detail.
The method `pygridsio.grid_plotting.make_interactive_plot` Creates a interactive .html plot using plotly
The method `pygridsio.grid_plotting.make_interactive_plot_with_map` Creates a interactive .html plot using plotly with a mapbox map underneath (not suitable for really large datasets)

## Installation to Develop the code further

### Anaconda
#### Create/update anaconda environment
The file `environment.yml` can be used to create a working development python environment with the needed packages.
For this open an `Anaconda Prompt` and:

`conda env create -f environment.yml`

Or to update the existing anaconda environment (with an updated version of the`environment.yml`file :

`conda env update -n pygridsio -f environment.yml`

#### Export (updated) anaconda environment
The `environment.yml` file needs to be updated when new packages are added:

`conda env export --from-history -n pygridsio > environment.yml`

#### Use anaconda environment in PyCharm
To connect the anaconda environment to Pycharm you can go to `File` , `Settings`, `Project`, `Python Interpreter`, `add interpreter`, `add local interpreter`, `conda environment` and then select the environment you created using the above steps.

### Poetry
Poetry is becoming the new way to manage your python projects and dependencies. 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. This can also be done using the Pycharm Python Interpreter interface.

### 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
To publish an updated version of the project to the pygridsio package registry I recommend using poetry.

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)

## How to import pygridsio into other python projects

### Pip

You can use pip to get the most up-to-date version of pygridsio:
`pip install pygridsio`


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pygridsio",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": null,
    "author": "Brett",
    "author_email": "hen.brett@tno.nl",
    "download_url": "https://files.pythonhosted.org/packages/41/7d/84343d8d76cbe5252b22b9d092049d35da7211e3c0245de483cf30c5010c/pygridsio-0.3.10.tar.gz",
    "platform": null,
    "description": "# pygridsio\n\n\n\n## Introduction\n\nThis is a python submodule containing IO functionality for reading and writing .asc, .zmap and .nc grids.\n\n## Usage\n\n`from pygridsio.pygridsio import *`\nThe standard grid class used throughout this project is an Xarray DataArray (see: https://xarray.dev/) with 2 dimensions: x and y.\n\nTo read a grid file to this class use:\n`grid = read_grid(filename)`\n\n\nWhen writing out grids, you can write out grids to a netcdf raster (.nc) which can be read easily by xarray, or QGIS or ArcGIS, .asc and .zmap are also supported:\n`write_grid(grid,filename)`\nThe code will discern which filetype to write out to by the file extension in filename.\n\n\nThere is some plotting functionality built into pygridsio using the `pygridsio.grid_plotting` module:\nThe 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.\nThe method `pygridsio.grid_plotting.plot_grid_comparison` Creates a plot comparing two grids values against eachother. See the description of the method for more detail.\nThe method `pygridsio.grid_plotting.make_interactive_plot` Creates a interactive .html plot using plotly\nThe method `pygridsio.grid_plotting.make_interactive_plot_with_map` Creates a interactive .html plot using plotly with a mapbox map underneath (not suitable for really large datasets)\n\n## Installation to Develop the code further\n\n### Anaconda\n#### Create/update anaconda environment\nThe file `environment.yml` can be used to create a working development python environment with the needed packages.\nFor this open an `Anaconda Prompt` and:\n\n`conda env create -f environment.yml`\n\nOr to update the existing anaconda environment (with an updated version of the`environment.yml`file :\n\n`conda env update -n pygridsio -f environment.yml`\n\n#### Export (updated) anaconda environment\nThe `environment.yml` file needs to be updated when new packages are added:\n\n`conda env export --from-history -n pygridsio > environment.yml`\n\n#### Use anaconda environment in PyCharm\nTo connect the anaconda environment to Pycharm you can go to `File` , `Settings`, `Project`, `Python Interpreter`, `add interpreter`, `add local interpreter`, `conda environment` and then select the environment you created using the above steps.\n\n### Poetry\nPoetry is becoming the new way to manage your python projects and dependencies. Install poetry here: https://python-poetry.org/docs/ \n(note: if you can't run poetry from your terminal, ensure that the poetry.exe is in your environment variables).\n\nThen after cloning this repo to your local machine, run:\n`poetry install`\n\nWhich will install a virtual environment in the gitlab repo. This can also be done using the Pycharm Python Interpreter interface.\n\n### Verify Installation\nYou can verify the installation of the different python packages by running the tests stored in `tests`. \nIn pycharm: Right-click on the folder marked `tests` and click on `Run python tests in test`\n\n## publishing the project to gitlab\nTo publish an updated version of the project to the pygridsio package registry I recommend using poetry.\n\nFirst configure the connection between poetry and the gitlab package registry:\n`poetry config repositories.gitlab_pygridsio https://YOURGITLABLOCATION/gitlab/api/v4/projects/17422/packages/pypi`\n\nAdd your own personal access token details (https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html):\n`poetry publish --repository gitlab_pygridsio -u\"token name\" -p \"token value\"`\n\nThen you can build and publish the project as a new deployment in the package registry:\n`poetry build`\n`poetry publish`\n(make sure the version number you publish is unique)\n\n## How to import pygridsio into other python projects\n\n### Pip\n\nYou can use pip to get the most up-to-date version of pygridsio:\n`pip install pygridsio`\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "io utilities for reading in .asc and .zmap grids",
    "version": "0.3.10",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f2ce4fab63021df87c9a98b21adcf6577122761b01a68bdb46dbdcb6e90a4def",
                "md5": "d87e7f1723c80cda884502581a966e0c",
                "sha256": "d887267c1b0a4afbd9884d13dc6b60314512891c5b8f859c867b077c7234df4c"
            },
            "downloads": -1,
            "filename": "pygridsio-0.3.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d87e7f1723c80cda884502581a966e0c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 1285990,
            "upload_time": "2025-02-26T08:40:22",
            "upload_time_iso_8601": "2025-02-26T08:40:22.257565Z",
            "url": "https://files.pythonhosted.org/packages/f2/ce/4fab63021df87c9a98b21adcf6577122761b01a68bdb46dbdcb6e90a4def/pygridsio-0.3.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "417d84343d8d76cbe5252b22b9d092049d35da7211e3c0245de483cf30c5010c",
                "md5": "b5128262cf34c93b67c849fdf6bb2a68",
                "sha256": "92383a77680f1432da002ddb64960a7f854f210878e9bcbfed7533bc8f0f14ec"
            },
            "downloads": -1,
            "filename": "pygridsio-0.3.10.tar.gz",
            "has_sig": false,
            "md5_digest": "b5128262cf34c93b67c849fdf6bb2a68",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 1283915,
            "upload_time": "2025-02-26T08:40:26",
            "upload_time_iso_8601": "2025-02-26T08:40:26.641227Z",
            "url": "https://files.pythonhosted.org/packages/41/7d/84343d8d76cbe5252b22b9d092049d35da7211e3c0245de483cf30c5010c/pygridsio-0.3.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-26 08:40:26",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pygridsio"
}
        
Elapsed time: 1.61361s