Name | rms-vicar JSON |
Version |
1.1.0
JSON |
| download |
home_page | None |
Summary | Routines for converting to and from VICAR image files |
upload_time | 2024-07-11 19:15:37 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | Apache-2.0 |
keywords |
vicar
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
[![GitHub release; latest by date](https://img.shields.io/github/v/release/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/releases)
[![GitHub Release Date](https://img.shields.io/github/release-date/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/releases)
[![Test Status](https://img.shields.io/github/actions/workflow/status/SETI/rms-vicar/run-tests.yml?branch=main)](https://github.com/SETI/rms-vicar/actions)
[![Documentation Status](https://readthedocs.org/projects/rms-vicar/badge/?version=latest)](https://rms-vicar.readthedocs.io/en/latest/?badge=latest)
[![Code coverage](https://img.shields.io/codecov/c/github/SETI/rms-vicar/main?logo=codecov)](https://codecov.io/gh/SETI/rms-vicar)
<br />
[![PyPI - Version](https://img.shields.io/pypi/v/rms-vicar)](https://pypi.org/project/rms-vicar)
[![PyPI - Format](https://img.shields.io/pypi/format/rms-vicar)](https://pypi.org/project/rms-vicar)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/rms-vicar)](https://pypi.org/project/rms-vicar)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rms-vicar)](https://pypi.org/project/rms-vicar)
<br />
[![GitHub commits since latest release](https://img.shields.io/github/commits-since/SETI/rms-vicar/latest)](https://github.com/SETI/rms-vicar/commits/main/)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/commits/main/)
[![GitHub last commit](https://img.shields.io/github/last-commit/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/commits/main/)
<br />
[![Number of GitHub open issues](https://img.shields.io/github/issues-raw/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/issues)
[![Number of GitHub closed issues](https://img.shields.io/github/issues-closed-raw/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/issues)
[![Number of GitHub open pull requests](https://img.shields.io/github/issues-pr-raw/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/pulls)
[![Number of GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed-raw/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/pulls)
<br />
![GitHub License](https://img.shields.io/github/license/SETI/rms-vicar)
[![Number of GitHub stars](https://img.shields.io/github/stars/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/stargazers)
![GitHub forks](https://img.shields.io/github/forks/SETI/rms-vicar)
# Introduction
`vicar` is a Python module that supports reading and writing of JPL's VICAR file format. It supports the definition of the VICAR file format as found here:
[https://pds-rings.seti.org/help/VICAR_file_fmt.pdf](https://pds-rings.seti.org/help/VICAR_file_fmt.pdf)
# Installation
The `vicar` module is available via the `rms-vicar` package on PyPI and can be
installed with:
```sh
pip install rms-vicar
```
# Getting Started
The `vicar` module provides these classes:
- [`VicarLabel`](https://rms-vicar.readthedocs.io/en/latest/module.html#vicar.VicarLabel):
Class for reading, writing, and parsing of VICAR labels.
- [`VicarImage`](https://rms-vicar.readthedocs.io/en/latest/module.html#vicar.VicarImage):
Class for handling VICAR image (and other) data files.
- [`VicarError`](https://rms-vicar.readthedocs.io/en/latest/module.html#vicar.VicarError):
Extension of class ValueError to contain exceptions.
Details of each class are available in the [module documentation](https://rms-vicar.readthedocs.io/en/latest/module.html).
To read a VICAR image file:
```python
import vicar
vic = vicar.VicarImage("path/to/file")
```
The resulting object contains:
- `vic.array`: The 3-D data array converted to native format.
- `vic.array2d`: Same as above, but with leading dimension (typically, bands) stripped.
- `vic.prefix`: The array prefix bytes as a 3-D array of unsigned bytes.
- `vic.prefix2d`: Same as above, but with the leading dimension stripped.
- `vic.binheader`: The binary header as a bytes object; use `vic.binheader_array()` to
extract information.
- `vic.label`: The internal `VicarLabel` object that manages the VICAR label information,
if direct access is needed.
VICAR parameter values can be extracted from the label using dictionary-like syntax:
- `len(vic)`: The number of parameters in the VICAR label.
- `vic['LBLSIZE']`: The value of the LBLSIZE parameter (an integer).
- `vic[0]`: The value of the first parameter.
- `vic[-1]`: The value of the last parameter.
- `vic['LBLSIZE',-1]`: The value of the last occurrence of the LBLSIZE parameter.
- `vic.get(('LBLSIZE',2), 99)`: The value of the third occurrence of the LBLSIZE
parameter, or 99 if there are fewer than 3 occurrences.
- `vic.arg('LBLSIZE')`: The numeric index of "LBLSIZE" among the VICAR parameters.
You can also use dictionary-like syntax to modify and insert header values:
- `vic['SOLDIST'] = 1.e9`: Set SOLDICT to this value.
- `del vic['SOLDIST',0]`: Remove the first occurrence of SOLDIST from the label.
- `vic['LBLSIZE+'] = 2000`: Insert a new LBLSIZE parameter instead of modifying an
existing one.
Note that certain required VICAR parameters contain structural information about the file;
these cannot generally be modified directly.
Numerous methods are available to iterate over the VICAR label parameters:
```python
for (name,value) in vic.items(): ...
for key in vic.keys(): ...
for name in vic.names(): ...
for value in vic.values(): ...
```
Iterators can take a regular expression as input to restrict the items returned:
```python
for value in vic.values(r'LAB\d\d'): ...
```
Use `str(vic)` to get the VICAR label content represented as a string.
Here are the steps to create and write a VICAR image file:
```python
import vicar
vic = vicar.VicarImage()
vic.array = array
vic.prefix = prefix
vic.binheader = binheader
vic['NOTES'] = ['add as many more VICAR parameters', 'as you wish']
vic.write_file("path/to/file")
```
# Contributing
Information on contributing to this package can be found in the
[Contributing Guide](https://github.com/SETI/rms-vicar/blob/main/CONTRIBUTING.md).
# Links
- [Documentation](https://rms-vicar.readthedocs.io)
- [Repository](https://github.com/SETI/rms-vicar)
- [Issue tracker](https://github.com/SETI/rms-vicar/issues)
- [PyPi](https://pypi.org/project/rms-vicar)
# Licensing
This code is licensed under the [Apache License v2.0](https://github.com/SETI/rms-vicar/blob/main/LICENSE).
Raw data
{
"_id": null,
"home_page": null,
"name": "rms-vicar",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "\"Robert S. French\" <rfrench@seti.org>",
"keywords": "vicar",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/d7/58/6f1e243511cba3c7a96671be88306f9c87912fd45841ee0b65dcc5a00f81/rms_vicar-1.1.0.tar.gz",
"platform": null,
"description": "[![GitHub release; latest by date](https://img.shields.io/github/v/release/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/releases)\n[![GitHub Release Date](https://img.shields.io/github/release-date/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/releases)\n[![Test Status](https://img.shields.io/github/actions/workflow/status/SETI/rms-vicar/run-tests.yml?branch=main)](https://github.com/SETI/rms-vicar/actions)\n[![Documentation Status](https://readthedocs.org/projects/rms-vicar/badge/?version=latest)](https://rms-vicar.readthedocs.io/en/latest/?badge=latest)\n[![Code coverage](https://img.shields.io/codecov/c/github/SETI/rms-vicar/main?logo=codecov)](https://codecov.io/gh/SETI/rms-vicar)\n<br />\n[![PyPI - Version](https://img.shields.io/pypi/v/rms-vicar)](https://pypi.org/project/rms-vicar)\n[![PyPI - Format](https://img.shields.io/pypi/format/rms-vicar)](https://pypi.org/project/rms-vicar)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/rms-vicar)](https://pypi.org/project/rms-vicar)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rms-vicar)](https://pypi.org/project/rms-vicar)\n<br />\n[![GitHub commits since latest release](https://img.shields.io/github/commits-since/SETI/rms-vicar/latest)](https://github.com/SETI/rms-vicar/commits/main/)\n[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/commits/main/)\n[![GitHub last commit](https://img.shields.io/github/last-commit/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/commits/main/)\n<br />\n[![Number of GitHub open issues](https://img.shields.io/github/issues-raw/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/issues)\n[![Number of GitHub closed issues](https://img.shields.io/github/issues-closed-raw/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/issues)\n[![Number of GitHub open pull requests](https://img.shields.io/github/issues-pr-raw/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/pulls)\n[![Number of GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed-raw/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/pulls)\n<br />\n![GitHub License](https://img.shields.io/github/license/SETI/rms-vicar)\n[![Number of GitHub stars](https://img.shields.io/github/stars/SETI/rms-vicar)](https://github.com/SETI/rms-vicar/stargazers)\n![GitHub forks](https://img.shields.io/github/forks/SETI/rms-vicar)\n\n# Introduction\n\n`vicar` is a Python module that supports reading and writing of JPL's VICAR file format. It supports the definition of the VICAR file format as found here:\n[https://pds-rings.seti.org/help/VICAR_file_fmt.pdf](https://pds-rings.seti.org/help/VICAR_file_fmt.pdf)\n\n# Installation\n\nThe `vicar` module is available via the `rms-vicar` package on PyPI and can be\ninstalled with:\n\n```sh\npip install rms-vicar\n```\n\n# Getting Started\n\nThe `vicar` module provides these classes:\n\n- [`VicarLabel`](https://rms-vicar.readthedocs.io/en/latest/module.html#vicar.VicarLabel):\n Class for reading, writing, and parsing of VICAR labels.\n- [`VicarImage`](https://rms-vicar.readthedocs.io/en/latest/module.html#vicar.VicarImage):\n Class for handling VICAR image (and other) data files.\n- [`VicarError`](https://rms-vicar.readthedocs.io/en/latest/module.html#vicar.VicarError):\n Extension of class ValueError to contain exceptions.\n\nDetails of each class are available in the [module documentation](https://rms-vicar.readthedocs.io/en/latest/module.html).\n\n\nTo read a VICAR image file:\n\n```python\nimport vicar\nvic = vicar.VicarImage(\"path/to/file\")\n```\n\nThe resulting object contains:\n\n- `vic.array`: The 3-D data array converted to native format.\n- `vic.array2d`: Same as above, but with leading dimension (typically, bands) stripped.\n- `vic.prefix`: The array prefix bytes as a 3-D array of unsigned bytes.\n- `vic.prefix2d`: Same as above, but with the leading dimension stripped.\n- `vic.binheader`: The binary header as a bytes object; use `vic.binheader_array()` to\n extract information.\n- `vic.label`: The internal `VicarLabel` object that manages the VICAR label information,\n if direct access is needed.\n\nVICAR parameter values can be extracted from the label using dictionary-like syntax:\n\n- `len(vic)`: The number of parameters in the VICAR label.\n- `vic['LBLSIZE']`: The value of the LBLSIZE parameter (an integer).\n- `vic[0]`: The value of the first parameter.\n- `vic[-1]`: The value of the last parameter.\n- `vic['LBLSIZE',-1]`: The value of the last occurrence of the LBLSIZE parameter.\n- `vic.get(('LBLSIZE',2), 99)`: The value of the third occurrence of the LBLSIZE\n parameter, or 99 if there are fewer than 3 occurrences.\n- `vic.arg('LBLSIZE')`: The numeric index of \"LBLSIZE\" among the VICAR parameters.\n\nYou can also use dictionary-like syntax to modify and insert header values:\n\n- `vic['SOLDIST'] = 1.e9`: Set SOLDICT to this value.\n- `del vic['SOLDIST',0]`: Remove the first occurrence of SOLDIST from the label.\n- `vic['LBLSIZE+'] = 2000`: Insert a new LBLSIZE parameter instead of modifying an\n existing one.\n\nNote that certain required VICAR parameters contain structural information about the file;\nthese cannot generally be modified directly.\n\nNumerous methods are available to iterate over the VICAR label parameters:\n\n```python\nfor (name,value) in vic.items(): ...\nfor key in vic.keys(): ...\nfor name in vic.names(): ...\nfor value in vic.values(): ...\n```\n\nIterators can take a regular expression as input to restrict the items returned:\n\n```python\nfor value in vic.values(r'LAB\\d\\d'): ...\n```\n\nUse `str(vic)` to get the VICAR label content represented as a string.\n\nHere are the steps to create and write a VICAR image file:\n\n```python\nimport vicar\nvic = vicar.VicarImage()\nvic.array = array\nvic.prefix = prefix\nvic.binheader = binheader\nvic['NOTES'] = ['add as many more VICAR parameters', 'as you wish']\nvic.write_file(\"path/to/file\")\n```\n\n# Contributing\n\nInformation on contributing to this package can be found in the\n[Contributing Guide](https://github.com/SETI/rms-vicar/blob/main/CONTRIBUTING.md).\n\n# Links\n\n- [Documentation](https://rms-vicar.readthedocs.io)\n- [Repository](https://github.com/SETI/rms-vicar)\n- [Issue tracker](https://github.com/SETI/rms-vicar/issues)\n- [PyPi](https://pypi.org/project/rms-vicar)\n\n# Licensing\n\nThis code is licensed under the [Apache License v2.0](https://github.com/SETI/rms-vicar/blob/main/LICENSE).\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Routines for converting to and from VICAR image files",
"version": "1.1.0",
"project_urls": {
"Documentation": "https://rms-vicar.readthedocs.io/en/latest",
"Homepage": "https://github.com/SETI/rms-vicar",
"Issues": "https://github.com/SETI/rms-vicar/issues",
"Repository": "https://github.com/SETI/rms-vicar",
"Source": "https://github.com/SETI/rms-vicar"
},
"split_keywords": [
"vicar"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "baebc29fcc695e548c95d00354da24f9a9f3e57fe09711037dbe4d3b7feca574",
"md5": "6a784620677dc09f4451454a5ea0201e",
"sha256": "9dfc5d00f299f28e2e36832d8d46a3b26f5bb81db2c173d2136ee15257210f7a"
},
"downloads": -1,
"filename": "rms_vicar-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6a784620677dc09f4451454a5ea0201e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 41117,
"upload_time": "2024-07-11T19:15:35",
"upload_time_iso_8601": "2024-07-11T19:15:35.993576Z",
"url": "https://files.pythonhosted.org/packages/ba/eb/c29fcc695e548c95d00354da24f9a9f3e57fe09711037dbe4d3b7feca574/rms_vicar-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d7586f1e243511cba3c7a96671be88306f9c87912fd45841ee0b65dcc5a00f81",
"md5": "a01fa213e605ce003fd687c311827669",
"sha256": "82dfabcf4584f91d0ce597c006992738c6ada74292256519c600ab540ae12c82"
},
"downloads": -1,
"filename": "rms_vicar-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "a01fa213e605ce003fd687c311827669",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 5584508,
"upload_time": "2024-07-11T19:15:37",
"upload_time_iso_8601": "2024-07-11T19:15:37.411216Z",
"url": "https://files.pythonhosted.org/packages/d7/58/6f1e243511cba3c7a96671be88306f9c87912fd45841ee0b65dcc5a00f81/rms_vicar-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-11 19:15:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SETI",
"github_project": "rms-vicar",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"lcname": "rms-vicar"
}