Skip to content

Commit 299fb9d

Browse files
committed
Small edit to rhymer so that coordinates are propagated properly.
1 parent b1a6833 commit 299fb9d

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

hypernets_processor/rhymer/rhymer/hypstar/rhymer_hypstar.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from hypernets_processor.data_io.hypernets_writer import HypernetsWriter
1414
from hypernets_processor.calibration.calibrate import Calibrate
1515
from hypernets_processor.interpolation.interpolate import Interpolate
16+
from hypernets_processor.plotting.plotting import Plotting
1617
from hypernets_processor.data_io.format.metadata import METADATA_DEFS
1718
from hypernets_processor.data_io.format.variables import VARIABLES_DICT_DEFS
1819

@@ -28,6 +29,7 @@ def __init__(self, context):
2829
self.writer = HypernetsWriter(context)
2930
self.cal = Calibrate(context, MCsteps=100)
3031
self.intp = Interpolate(context, MCsteps=1000)
32+
self.plot=Plotting(context)
3133
self.rhymeranc = RhymerAncillary(context)
3234
self.rhymerproc = RhymerProcessing(context)
3335
self.rhymershared = RhymerShared(context)
@@ -384,10 +386,7 @@ def process_l1b(self, L1a_rad, L1a_irr):
384386
return L1b
385387

386388
def process_l1c(self, l1b):
387-
388-
l1c_dim_sizes_dict = {"wavelength": len(l1b["wavelength"]),
389-
"scan": len(np.unique(l1b['scan']))}
390-
dataset_l1c = self.hdsb.create_ds_template(l1c_dim_sizes_dict, "W_L1C", propagate_ds=l1b)
389+
dataset_l1c = self.l1c_from_l1b_dataset(l1b)
391390

392391
dataset_l1c = self.get_wind(dataset_l1c)
393392
dataset_l1c = self.get_fresnelrefl(dataset_l1c)
@@ -400,4 +399,28 @@ def process_l1c(self, l1b):
400399
#dataset_l1c['epsilon'].values = epsilon
401400
dataset_l1c['water_leaving_radiance'].values = lw_all.T
402401

402+
if self.context.get_config_value("write_l1c"):
403+
self.writer.write(dataset_l1c,overwrite=True)
404+
405+
if self.context.get_config_value("plot_l1c"):
406+
self.plot.plot_scans_in_series("irradiance",dataset_l1c)
407+
408+
return dataset_l1c
409+
410+
def l1c_from_l1b_dataset(self,dataset_l1b):
411+
"""
412+
Makes a L2 template of the data, and propagates the appropriate keywords from L1.
413+
414+
:param datasetl0:
415+
:type datasetl0:
416+
:return:
417+
:rtype:
418+
"""
419+
l1c_dim_sizes_dict = {"wavelength":len(dataset_l1b["wavelength"]),
420+
"scan":len(np.unique(dataset_l1b['scan']))}
421+
422+
dataset_l1c = self.hdsb.create_ds_template(l1c_dim_sizes_dict,"W_L1C",
423+
propagate_ds=dataset_l1b)
424+
dataset_l1c = dataset_l1c.assign_coords(wavelength=dataset_l1b.wavelength)
425+
403426
return dataset_l1c

0 commit comments

Comments
 (0)