Skip to main content

rms-vicar

GitHub release; latest by date GitHub Release Date Test Status Documentation Status Code coverage
PyPI - Version PyPI - Format PyPI - Downloads PyPI - Python Version
GitHub commits since latest release GitHub commit activity GitHub last commit
Number of GitHub open issues Number of GitHub closed issues Number of GitHub open pull requests Number of GitHub closed pull requests
GitHub License Number of GitHub stars GitHub forks

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

Installation

The vicar module is available via the rms-vicar package on PyPI and can be installed with:

pip install rms-vicar

Getting Started

The vicar module provides these classes:

  • VicarLabel: Class for reading, writing, and parsing of VICAR labels.
  • VicarImage: Class for handling VICAR image (and other) data files.
  • VicarError: Extension of class ValueError to contain exceptions.

Details of each class are available in the module documentation.

To read a VICAR image file:

import vicar
vic = vicar.VicarImage("path/to/file")

(The file path can be any URL accepted by FCPath.)

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:

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:

for value in vic.values(r'LAB\d\d'): ...

Use vic.as_dict() to get a copy of the label content as a plain Python dictionary, keyed the same way as vic.keys(). Use vic.as_dict(unique=False) to key it by name alone, keeping only the first occurrence of a repeated name, and indices=True to add an entry for each parameter's integer index.

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:

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.

Links

Licensing

This code is licensed under the Apache License v2.0.

Metadata

Release files for rms-vicar 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rms-vicar 1.4.0
File Size Uploaded Provenance Actions
rms_vicar-1.4.0.tar.gz 5.7 MB Without provenance Details for rms_vicar-1.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rms-vicar 1.4.0
File Interpreter ABI Platform Actions
rms_vicar-1.4.0-py3-none-any.whl Python 3 none any Details for rms_vicar-1.4.0-py3-none-any.whl

Total release size: 5.7 MB

Release files / rms_vicar-1.4.0.tar.gz

Download URL rms_vicar-1.4.0.tar.gz
Size 5.7 MB
Tags Source
SHA-256 checksum
How to use checksums
8c6d0e755e8fd8a1412c5409f50617ff1f7a8e5d7eecadbc8770ada0518602b3
BLAKE2b-256 checksum
How to use checksums
b022a0afeffaa4ad71c4251c1b3de11273ca00f914b608d277839d55431733c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rms_vicar-1.4.0-py3-none-any.whl

Download URL rms_vicar-1.4.0-py3-none-any.whl
Size 44.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16f444fb446c14bf84942df5ee6f0481b9b17e9d5398378a8e454aa2bb7c7fbc
BLAKE2b-256 checksum
How to use checksums
4c6b07a4416c14368ba12204373490c86a1f999d30a2fbb81f33e07a534e14fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for rms-vicar 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page