def produce_product(self): chl_path = Resolver().raw_file(CHL, 'NESLTERchl.xlsx') parsed = parse_chl(chl_path) subset = subset_chl(parsed) chl = subset[subset['cruise'] == self.cruise.upper()] bottle_summary = CtdBottleSummaryWorkflow( self.cruise).produce_product() return merge_bottle_summary(chl, bottle_summary)
def produce_product(self): bottle_summary = CtdBottleSummaryWorkflow(self.cruise).get_product() nut_path = Resolver().raw_file(NUT, 'LTERnut.xlsx') parent_dir = os.path.dirname(os.path.dirname(nut_path)) # .. sample_log_path = os.path.join(parent_dir, 'LTER_sample_log.xlsx') merged = merge_nut_bottles(sample_log_path, nut_path, bottle_summary, self.cruise) return add_nearest_station(self.cruise, merged)
def sidecar_file_path(cruise, filename): try: elog_dir = Resolver().raw_directory('elog', cruise) except KeyError: return None path = os.path.join(elog_dir, filename) if not os.path.exists(path): return None return path
def cruise_metadata(request): rows = [] cruises = Resolver().cruises() for cruise in cruises: start_date = '' end_date = '' try: elog = EventLogWorkflow(cruise).get_product() start_date = elog[elog['Action'] == 'startCruise'].iloc[0]['dateTime8601'] end_date = elog[elog['Action'] == 'endCruise'].iloc[0]['dateTime8601'] except KeyError: # no elog for this cruise pass except ValueError: # error procssing elog pass rows.append({ 'cruise': cruise, 'start': start_date, 'end': end_date, }) df = pd.DataFrame(rows) return dataframe_response(df, 'cruise_metadata', 'csv')
def hdr_path(cruise): try: return Resolver().raw_directory('ctd', cruise) except KeyError: return None
def elog_path(cruise): elog_dir = Resolver().raw_directory('elog', cruise) candidates = glob(os.path.join(elog_dir, 'R2R_ELOG_*_FINAL_EVENTLOG*.csv')) assert len(candidates) == 1, 'cannot find event log at {}'.format(elog_dir) return candidates[0]
def directories(self): return Resolver().directories(UNDERWAY, self.cruise)
def produce_product(self): hplc_dir = Resolver().raw_directory(HPLC) all_hplc = parse_hplc(hplc_dir) cruise_hplc = all_hplc[all_hplc['cruise'].str.lower() == self.cruise] return add_nearest_station(self.cruise, cruise_hplc)
def directories(self): return Resolver().directories(HPLC, self.cruise, skip_raw=True)
def cruises(request): cruises = Resolver().cruises() return JsonResponse({'cruises': cruises})
def directories(self): return Resolver().directories(EVENT_LOG, self.cruise)
def directories(self): return Resolver().directories(CTD, self.cruise)