Skip to content

Commit

Permalink
Merge pull request #1595 from danforthcenter/add_geores_to_spectral
Browse files Browse the repository at this point in the history
Add metadata attribute to spectral_data class
  • Loading branch information
nfahlgren authored Sep 13, 2024
2 parents 26bfd9a + a3ad6c3 commit 1242505
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
4 changes: 1 addition & 3 deletions docs/Spectral_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ Attributes are accessed as spectral_data_instance.*attribute*.

**filename**: The filename where the data originated from

**geo_transform**: The affine transformation matrix used to convert from an xy coordinate system to a georeferenced coordinate system. Default is the input list used by the affine package to create an identity matrix.

**geo_crs**: The original coordinate system of a georeferenced image. Default is "None".
**metadata**: Metadata in a dictionary. Included keys might be specific to hyperspectral or geospatial image types

### Example

Expand Down
13 changes: 5 additions & 8 deletions plantcv/plantcv/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class Spectral_data:

def __init__(self, array_data, max_wavelength, min_wavelength, max_value, min_value, d_type, wavelength_dict,
samples, lines, interleave, wavelength_units, array_type, pseudo_rgb, filename, default_bands,
geo_transform=None, geo_crs=None):
metadata=None):
# The actual array/datacube
self.array_data = array_data
# Min/max available wavelengths (for spectral datacube)
Expand All @@ -326,13 +326,10 @@ def __init__(self, array_data, max_wavelength, min_wavelength, max_value, min_va
self.filename = filename
# The default band indices needed to make an pseudo_rgb image, if not available then store None
self.default_bands = default_bands
# The transformation matrix that converts xy coordinates to georeferenced coordinates
# Default is the input list for affine.Affine to make an identity matrix
self.geo_transform = geo_transform
if not geo_transform:
self.geo_transform = (1.0, 0.0, 0.0, 0.0, 1.0, 0.0)
# The coordinate system of a georeferenced image
self.geo_crs = geo_crs
# Metadata, flexible components in a dictionary
self.metadata = metadata
if not metadata:
self.metadata = {}


class PSII_data:
Expand Down

0 comments on commit 1242505

Please sign in to comment.