def load_observations_for_station(station_name, element_name): """Load observations for a specific stations.""" element_id = data_io.get_element_id(element_name, "fc") # TODO Add support if element_id != 999: raise NotImplementedError() observations = data_io.read_observations(element_id, station_name) return observations
def add_observations(forecast_data, element_id, station_names): """Merge observations into provided forecast data.""" # TODO Right now, TWING observations are stored separately. # Have the same treatment regardless of element. merged_data = forecast_data if element_id == 999: for station_name in station_names: logging.debug( "Adding observations for element %d, station %s" % (element_id, station_name)) observations = data_io.read_observations(element_id, station_name) merged_data = pd.DataFrame.merge( merged_data, observations, how='outer', copy=False ) else: observations = data_io.read_knmi_observations(station_names) merged_data = pd.DataFrame.merge( merged_data, observations, on=['valid_date', 'station_name'], how='outer', copy=False ) return merged_data