示例#1
0
 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)
示例#2
0
 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)
示例#3
0
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
示例#4
0
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')
示例#5
0
def hdr_path(cruise):
    try:
        return Resolver().raw_directory('ctd', cruise)
    except KeyError:
        return None
示例#6
0
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]
示例#7
0
 def directories(self):
     return Resolver().directories(UNDERWAY, self.cruise)
示例#8
0
 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)
示例#9
0
 def directories(self):
     return Resolver().directories(HPLC, self.cruise, skip_raw=True)
示例#10
0
def cruises(request):
    cruises = Resolver().cruises()
    return JsonResponse({'cruises': cruises})
示例#11
0
 def directories(self):
     return Resolver().directories(EVENT_LOG, self.cruise)
示例#12
0
 def directories(self):
     return Resolver().directories(CTD, self.cruise)