SETI / rms-vicar

vicar Python module
Apache License 2.0
0 stars 1 forks source link

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:

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 resulting object contains:

VICAR parameter values can be extracted from the label using dictionary-like syntax:

You can also use dictionary-like syntax to modify and insert header values:

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 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.