2. What’s new in CATALYST Python API¶
This section explains the new features in CATALYST by version.
2.1. What’s new in 2019¶
2.1.1. Data Downloading¶
pci.downloaders package has been added to allow users to download
data from various sensor APIs using one simple interface. In this release
the following APIs are supported:
Development Seed API (for Landsat-8 data)
NASA’s Common Metadata Repository API
2.1.2. Model segment metadata¶
Prior to this release, unlike most other segment types, there was no object that represented a math model segment. So, while the ability to read and write a math model was available, the ability to read and write the segment metadata, description and history was not.
With the addition of
functionality is now available just like it is for other segment types.
2.2. What’s new in 2018¶
Support for vector segments has been added. A vector segment contains a collection
of shapes with geometry and attributes. The geometry is stored as a tuple of
numpy.ndarray with one array
for each ring of the shape, and the attributes are stored as a sequence of
2.2.2. File formats¶
FileFormat class has been added for determining the file format
Dataset, along with helper functions for
getting the file format of a path, getting a
format name, and getting the
file extension of a format.
2.2.4. Dataset operations (dsops)¶
2.2.5. Input source¶
pci.api.inputsource is a framework that provides an abstraction
to iterate over various sources (including file system and MFILE).
pci.api.finder provides a framework for finding, filtering, and
handling files from various input sources.
The subclasses of
can be used to search for files that satisfy subclasses of
AbstractFilenameFilter. The resulting
files can be handled by subclasses of
2.3. What’s new in 2017¶
Several improvements have been made to the
126.96.36.199. Named NSPIO instances¶
When registering an NSPIO implementation, you can now specify the implementation name. You can register more than one function/class for each implementation. For more information, see NSPIO implementation naming.
You can also get a list of registered instances names by calling
getInstanceNames() for each
implementation. For example, you can get a list of registered counter implementations by calling
188.8.131.52. Counter.update status messages¶
Counter.update has been modified to allow for an optional
184.108.40.206. Optional function arguments¶
When you write an NSPIO handler instance, you can now write a function with or without the optional argument.
For example, either of the following functions can be registered as a
1 2 3 4 5 6 7 8 9
def update(d): status = '%d%% complete'.format(d*100) print(status) def update_with_msg(d, msg): status = '%d%% complete'.format(d*100) if msg: status += ' - ' + msg print(status)
2.4. What’s new in 2016¶
2.4.1. New segment types¶
Support for additional segment types has been added in version 2016.
A PCT segment contains a pseudocolor table (PCT) for assigning RGB color to one-channel images.
The pseudocolor table is represented by
pci.api.gobs.PCT. A dataset that has a
PCT is represented by a
pci.api.datasource.PCTDataset and a
pci.api.datasource.PCTIO is used to read and write a
to and from a PCT segment.
A LUT segment contains a lookup table (LUT) for applying enhancements to raster data.
The lookup table is represented by
pci.api.gobs.LUT. A dataset that has a
LUT is represented by a
pci.api.datasource.LUTDataset, and a
pci.api.datasource.LUTIO is used to read and write a
to and from a LUT segment.
A text segment contains text data. A dataset that has a
text segment is represented by a
pci.api.datasource.TextDataset, and a
pci.api.datasource.TextIO is used to read and write a string
to and from a text segment.
An array segment contains an array of numbers. The array can be single-dimensional or multi-dimensional.
The array is represented by a
A dataset that has an array is represented by a
pci.api.datasource.ArrayDataset, and a
pci.api.datasource.ArrayIO is used to read and write a
to and from an array segment.
An orbit segment contains ephemeris data related to the orbit of a sensor. The ephemeris data
is represented by a
pci.api.mathmodel.EphemerisData. A dataset that has an
orbit segment is represented by a
it can be used to read and write
to and from an orbit segment.
2.4.2. Dataset interface changes¶
220.127.116.11. BasicReader and BasicWriter¶
Along with the addition of the
close member function,
the constructors of
pci.api.datasource.BasicWriter have been modified so that they now take a
Dataset as an argument instead of filename. By doing so, a developer
can ensure that the
Dataset is properly closed also when
BasicWriter, because it will be closed when the
context is exited.
18.104.22.168.1. BasicReader in CATALYST 2015¶
The following example demonstrates how to read from
BasicReader in version 2015:
1 2 3 4 5 6 7 8 9 10 11 12 13
import pci assert pci.version[:4] == '2015' # check for version 2015 from pci.api import datasource as ds # create a reader reader = ds.BasicReader('myfile.pix', [1,2,3]) # read the whole raster raster = reader.read_raster(0, 0, reader.width, reader.height) # there is no guarantee when the file will be closed even if it is deleted del reader
22.214.171.124.2. BasicReader in CATALYST 2016¶
The following example demonstrates how to read from
BasicReader in version 2016:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import pci assert pci.version[:4] >= '2016' # check for version 2016 from pci.api import datasource as ds # open the dataset with ds.open_dataset('myfile.pix') as dataset: # create a reader reader = ds.BasicReader(dataset, [1,2,3]) # read the whole raster raster = reader.read_raster(0, 0, reader.width, reader.height) # the with block context has exited, so the file is now closed ...
2.4.3. cts improvements¶
A few classes and functions have been added to the
126.96.36.199. Earth models¶
188.8.131.52. CRS utilities¶
Some utility functions have been added to get a string representation of a
pci.api.cts.get_utm_zone() has been added to determine the best UTM zone to use
for a specified point on the Earth.