Merge pull request #2 from gshiroma/updating_sensor_UAVSAR_HDF5_SLC
Updates the sensor: UAVSAR_HDF5_SLCLT1AB
commit
b478fa4e9b
|
@ -80,16 +80,6 @@ POLARIZATION = Component.Parameter(
|
||||||
doc='polarization channel of the UAVSAR slc file to be processed'
|
doc='polarization channel of the UAVSAR slc file to be processed'
|
||||||
)
|
)
|
||||||
|
|
||||||
class DummySink(object):
|
|
||||||
def write(self, data):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __exit__(*x):
|
|
||||||
pass
|
|
||||||
|
|
||||||
from .Sensor import Sensor
|
from .Sensor import Sensor
|
||||||
class UAVSAR_HDF5_SLC(Sensor):
|
class UAVSAR_HDF5_SLC(Sensor):
|
||||||
"""
|
"""
|
||||||
|
@ -263,14 +253,8 @@ class UAVSAR_HDF5_SLC(Sensor):
|
||||||
ds = fid['/science/LSAR/SLC/swaths/' + self.frequency + '/' + self.polarization]
|
ds = fid['/science/LSAR/SLC/swaths/' + self.frequency + '/' + self.polarization]
|
||||||
nLines = ds.shape[0]
|
nLines = ds.shape[0]
|
||||||
|
|
||||||
# if TypeError is raised (e.g. complex32), force casting to complex64
|
# force casting to complex64
|
||||||
try:
|
with ds.astype(np.complex64):
|
||||||
_ = ds.dtype
|
|
||||||
sink = DummySink()
|
|
||||||
except TypeError:
|
|
||||||
sink = ds.astype(np.complex64)
|
|
||||||
|
|
||||||
with sink:
|
|
||||||
with open(self.output, 'wb') as fout:
|
with open(self.output, 'wb') as fout:
|
||||||
for ii in range(nLines):
|
for ii in range(nLines):
|
||||||
ds[ii, :].tofile(fout)
|
ds[ii, :].tofile(fout)
|
||||||
|
|
Loading…
Reference in New Issue