Skip to content
Snippets Groups Projects
Commit 9f9806e2 authored by acpaquette's avatar acpaquette Committed by jlaura
Browse files

Updated m3 with derived products from pysat (#66)

parent e7263e77
Branches
Tags
No related merge requests found
...@@ -2,6 +2,15 @@ import os ...@@ -2,6 +2,15 @@ import os
import numpy as np import numpy as np
from .io_gdal import GeoDataset from .io_gdal import GeoDataset
from .hcube import HCube from .hcube import HCube
try:
from libpysat.derived import m3, crism
from libpysat.derived.utils import add_derived_funcs
libpysat_enabled = True
except:
print('No libpysat module. Unable to attached derived product functions')
libpysat_enabled = False
import gdal import gdal
...@@ -9,6 +18,24 @@ class M3(GeoDataset, HCube): ...@@ -9,6 +18,24 @@ class M3(GeoDataset, HCube):
""" """
An M3 specific reader with the spectral mixin. An M3 specific reader with the spectral mixin.
""" """
def __init__(self, file_name):
GeoDataset.__init__(self, file_name)
HCube.__init__(self)
if libpysat_enabled:
self.derived_funcs = add_derived_funcs(m3)
def __getattr__(self, name):
try:
func = self.derived_funcs[name]
setattr(self, name, func.__get__(self))
return getattr(self, name)
except:
raise AttributeError()
@property @property
def wavelengths(self): def wavelengths(self):
if not hasattr(self, '_wavelengths'): if not hasattr(self, '_wavelengths'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment