def __interpolate_QP(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_QP Parameters:[I] metro_data wf_originpl_data : originpl data. Read-only [I] metro_data wf_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, shift_right metro_data.get_matrix_col metro_data.append_matrix_col Description: Add the rain (in mm.) and the snow (in cm.) and store it in RA. Since 1 cm. is, roughly, 1 mm. of water, the sum is considerated in mm. Revision History: Author Date Reason Miguel Tremblay July 12th 2004 """ npRA = wf_originpl_data.get_matrix_col('RA') npSN = wf_originpl_data.get_matrix_col('SN') npQP = npSN/10*metro_constant.nSnowWaterRatio \ + npRA # Patch because of the -99 at the end of the forecast fMax = npQP.max() npQP = numpy.where(npQP < 0, fMax, npQP) # Compute the amount fell at each time step npQP = npQP - metro_util.shift_right(npQP, 0) npSN = npSN - metro_util.shift_right(npSN, 0) npRA = npRA - metro_util.shift_right(npRA, 0) # Interpolate these values at each time step npQP = metro_util.interpolate(self.npTime, npQP) npSN = metro_util.interpolate(self.npTime, npSN) npRA = metro_util.interpolate(self.npTime, npRA) # Shift all the values to have them started at the right time npQP = metro_util.shift_left(npQP, 0) npSN = metro_util.shift_left(npSN, 0) npRA = metro_util.shift_left(npRA, 0) npQP = npQP * 10e-4 # Set it in meter npQP = npQP / 3600.0 # Convert by second npQP = numpy.where(npQP < 0, 0, npQP) wf_interpolated_data.append_matrix_col('QP', npQP) wf_interpolated_data.append_matrix_col('SN', npSN) wf_interpolated_data.append_matrix_col('RA', npRA)
def __interpolate_QP(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_QP Parameters:[I] metro_data wf_originpl_data : originpl data. Read-only [I] metro_data wf_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, shift_right metro_data.get_matrix_col metro_data.append_matrix_col Description: Add the rain (in mm.) and the snow (in cm.) and store it in RA. Since 1 cm. is, roughly, 1 mm. of water, the sum is considerated in mm. Revision History: Author Date Reason Miguel Tremblay July 12th 2004 """ npRA = wf_originpl_data.get_matrix_col('RA') npSN = wf_originpl_data.get_matrix_col('SN') npQP = npSN/10*metro_constant.nSnowWaterRatio \ + npRA # Patch because of the -99 at the end of the forecast fMax = npQP.max() npQP = numpy.where(npQP < 0, fMax, npQP) # Compute the amount fell at each time step npQP = npQP - metro_util.shift_right(npQP, 0) npSN = npSN - metro_util.shift_right(npSN, 0) npRA = npRA - metro_util.shift_right(npRA, 0) # Interpolate these values at each time step npQP = metro_util.interpolate(self.npTime, npQP) npSN = metro_util.interpolate(self.npTime, npSN) npRA = metro_util.interpolate(self.npTime, npRA) # Shift all the values to have them started at the right time npQP = metro_util.shift_left(npQP, 0) npSN = metro_util.shift_left(npSN, 0) npRA = metro_util.shift_left(npRA, 0) npQP = npQP *10e-4 # Set it in meter npQP = npQP / 3600.0 # Convert by second npQP = numpy.where(npQP < 0, 0, npQP) wf_interpolated_data.append_matrix_col('QP', npQP) wf_interpolated_data.append_matrix_col('SN', npSN) wf_interpolated_data.append_matrix_col('RA', npRA)
def __set_sf(self, wf_controlled_data, wf_interpolated_data): """ Set the theoretical solar flux. Parameters: wf_controlled_data (metro_data) : controlled data. Read-only """ npTime = wf_controlled_data.get_matrix_col('Time') # Only interpolate if SF is given if metro_config.get_value('SF'): npSF = wf_controlled_data.get_matrix_col('SF') npSF2 = metro_util.interpolate(npTime, npSF) if ((self.infdata_exist('HORIZON')) and (self.npAzim != None)): npFT2 = wf_interpolated_data.get_matrix_col('FORECAST_TIME') tDate2 = [time.gmtime(x) for x in npFT2] sunshadw_method = metro_config.get_value('SUNSHADOW_METHOD') npSF2 = metro_preprocess_sunshadw.\ get_corrected_solar_flux(tDate2, npSF2, \ self.fLat, self.fLon,\ zip(self.npAzim, self.npElev),\ m=sunshadw_method) wf_interpolated_data.append_matrix_col('SF', npSF2) return # Get data npCloudOctal = wf_controlled_data.get_matrix_col('CC') npTimeHour = wf_controlled_data.get_matrix_col('Hour') npForecastedTime = wf_controlled_data.\ get_matrix_col('FORECAST_TIME') fStartForecastTime = npForecastedTime[0] # Get solar fluxes for this cloud cover for this specific day npSF = metro_physics.get_sf(npCloudOctal, npTimeHour, \ npForecastedTime,\ self.fSunrise, self.fSunset,\ self.fLat, self.fLon) npSF2 = metro_util.interpolate(npTime, npSF) if ((self.infdata_exist('HORIZON')) and (self.npAzim != None)): npFT2 = wf_interpolated_data.get_matrix_col('FORECAST_TIME') tDate2 = [time.gmtime(x) for x in npFT2] sunshadw_method = metro_config.get_value('SUNSHADOW_METHOD') npSF2 = metro_preprocess_sunshadw.\ get_corrected_solar_flux(tDate2, npSF2, \ self.fLat, self.fLon,\ zip(self.npAzim, self.npElev),\ m=sunshadw_method) wf_controlled_data.append_matrix_col('SF', npSF) wf_interpolated_data.append_matrix_col('SF', npSF2)
def __set_sf(self, wf_controlled_data, wf_interpolated_data): """ Set the theoretical solar flux. Parameters: wf_controlled_data (metro_data) : controlled data. Read-only """ npTime = wf_controlled_data.get_matrix_col('Time') # Only interpolate if SF is given if metro_config.get_value('SF'): npSF = wf_controlled_data.get_matrix_col('SF') npSF2 = metro_util.interpolate(npTime, npSF) if ((self.infdata_exist('HORIZON')) and (self.npAzim != None)): npFT2 = wf_interpolated_data.get_matrix_col('FORECAST_TIME') tDate2 = [time.gmtime(x) for x in npFT2] sunshadw_method = metro_config.get_value('SUNSHADOW_METHOD') npSF2 = metro_preprocess_sunshadw.\ get_corrected_solar_flux(tDate2, npSF2, \ self.fLat, self.fLon,\ zip(self.npAzim, self.npElev),\ m=sunshadw_method) wf_interpolated_data.append_matrix_col('SF', npSF2) return # Get data npCloudOctal = wf_controlled_data.get_matrix_col('CC') npTimeHour = wf_controlled_data.get_matrix_col('Hour') npForecastedTime = wf_controlled_data.\ get_matrix_col('FORECAST_TIME') fStartForecastTime =npForecastedTime [0] # Get solar fluxes for this cloud cover for this specific day npSF = metro_physics.get_sf(npCloudOctal, npTimeHour, \ npForecastedTime,\ self.fSunrise, self.fSunset,\ self.fLat, self.fLon) npSF2 = metro_util.interpolate(npTime, npSF) if ((self.infdata_exist('HORIZON')) and (self.npAzim != None)): npFT2 = wf_interpolated_data.get_matrix_col('FORECAST_TIME') tDate2 = [time.gmtime(x) for x in npFT2] sunshadw_method = metro_config.get_value('SUNSHADOW_METHOD') npSF2 = metro_preprocess_sunshadw.\ get_corrected_solar_flux(tDate2, npSF2, \ self.fLat, self.fLon,\ zip(self.npAzim, self.npElev),\ m=sunshadw_method) wf_controlled_data.append_matrix_col('SF', npSF) wf_interpolated_data.append_matrix_col('SF', npSF2)
def __interpolate_TD(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_TD Parameters:[I] metro_data wf_originpl_data : originpl data. Read-only [I] metro_data wf_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Interpolate the dew point. Revision History: Author Date Reason Miguel Tremblay July 12th 2004 """ npTD = wf_originpl_data.get_matrix_col('TD') npTD = metro_util.interpolate(self.npTime, npTD) wf_interpolated_data.append_matrix_col('TD', npTD)
def __interpolate_WS(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_WS Parameters:[I] metro_data wf_originpl_data : originpl data. Read-only [I] metro_data wf_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Interpolate wind speed. Wind is in km/h and is converted in m/s by the product with 0.2777777 Revision History: Author Date Reason Miguel Tremblay July 12th 2004 """ npWS = wf_originpl_data.get_matrix_col('WS') * 0.2777777 npWS = metro_util.interpolate(self.npTime, npWS) wf_interpolated_data.append_matrix_col('WS', npWS)
def __interpolate_WS(self, ro_controlled_data, ro_interpolated_data): """ Name: __interpolate_WS Parameters:[I] metro_data ro_controlled_data : controlled data. Read-only [I] metro_data ro_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Does the interpolation of the wind speed. Wind is in km/h and is converted in m/s by the product with 0.2777777 Revision History: Author Date Reason Miguel Tremblay August 11th 2004 """ npTimeOrig = ro_controlled_data.get_matrix_col('Time') npWS = ro_controlled_data.get_matrix_col('WS')*0.2777777 npWS = metro_util.interpolate(npTimeOrig, npWS) ro_interpolated_data.append_matrix_col('WS', npWS)
def __interpolate_AT(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_AT Parameters:[I] metro_data wf_originpl_data : originpl data. Read-only [I] metro_data wf_processed_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Does the interpolation of the air temperature Revision History: Author Date Reason Miguel Tremblay July 12th 2004 """ npAT = wf_originpl_data.get_matrix_col('AT') npAT = metro_util.interpolate(self.npTime, npAT) wf_interpolated_data.append_matrix_col('AT', npAT)
def __interpolate_PI(self, ro_controlled_data, ro_interpolated_data): """ Name: __interpolate_PI Parameters:[I] metro_data ro_controlled_data : controlled data. Read-only [I] metro_data ro_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col numpy.where, around Description: Does the interpolation of presence of precipitation. """ npTimeOrig = ro_controlled_data.get_matrix_col('Time') npPI = ro_controlled_data.get_matrix_col('PI') npPI = numpy.where(npPI != 1, 0, npPI) npPI = metro_util.interpolate(npTimeOrig, npPI) # Round npPI = numpy.around(npPI) # Store ro_interpolated_data.append_matrix_col('PI', npPI)
def __interpolate_WS(self, ro_controlled_data, ro_interpolated_data): """ Name: __interpolate_WS Parameters:[I] metro_data ro_controlled_data : controlled data. Read-only [I] metro_data ro_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Does the interpolation of the wind speed. Wind is in km/h and is converted in m/s by the product with 0.2777777 Revision History: Author Date Reason Miguel Tremblay August 11th 2004 """ npTimeOrig = ro_controlled_data.get_matrix_col('Time') npWS = ro_controlled_data.get_matrix_col('WS') * 0.2777777 npWS = metro_util.interpolate(npTimeOrig, npWS) ro_interpolated_data.append_matrix_col('WS', npWS)
def __interpolate_CC(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_cloud_cover Parameters: [I] metro_data wf_controlled_data : controlled data. Read-only [I] metro_data wf_interpolated_data : container of the interpolated Returns: None Description: Interpolate the cloud cover. Added in the roadcast file to be able to draw the the cloud cover. Notes: <other information, if any> Revision History: Author Date Reason Miguel Tremblay June 20th 2005 """ lCC = wf_originpl_data.get_matrix_col('CC') npCC = numpy.array(lCC) # Interpolate npCC = metro_util.interpolate(self.npTime, npCC) # Round npCC = numpy.around(npCC) # Store wf_interpolated_data.append_matrix_col('CC', npCC)
def __interpolate_WS(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_WS Parameters:[I] metro_data wf_originpl_data : originpl data. Read-only [I] metro_data wf_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Interpolate wind speed. Wind is in km/h and is converted in m/s by the product with 0.2777777 Revision History: Author Date Reason Miguel Tremblay July 12th 2004 """ npWS = wf_originpl_data.get_matrix_col('WS')*0.2777777 npWS = metro_util.interpolate(self.npTime, npWS) wf_interpolated_data.append_matrix_col('WS', npWS)
def __interpolate_AP(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_AP Parameters:[I] metro_data wf_originpl_data : originpl data. Read-only [I] metro_data wf_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Interpolate the surface pressure. Pressure in in hectopascal. Revision History: Author Date Reason Miguel Tremblay July 12th 2004 """ npAP = wf_originpl_data.get_matrix_col('AP') # Replace invalid date by the normal pressure (1013.25 mb) npAP = numpy.where(npAP < metro_constant.nLowerPressure,\ metro_constant.fNormalPressure, npAP) npAP = numpy.where(npAP > metro_constant.nUpperPressure,\ metro_constant.fNormalPressure, npAP) # Convert it in pascals. npAP = npAP*100 npAP = metro_util.interpolate(self.npTime, npAP) wf_interpolated_data.append_matrix_col('AP', npAP)
def __interpolate_AP(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_AP Parameters:[I] metro_data wf_originpl_data : originpl data. Read-only [I] metro_data wf_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Interpolate the surface pressure. Pressure in in hectopascal. Revision History: Author Date Reason Miguel Tremblay July 12th 2004 """ npAP = wf_originpl_data.get_matrix_col('AP') # Replace invalid date by the normal pressure (1013.25 mb) npAP = numpy.where(npAP < metro_constant.nLowerPressure,\ metro_constant.fNormalPressure, npAP) npAP = numpy.where(npAP > metro_constant.nUpperPressure,\ metro_constant.fNormalPressure, npAP) # Convert it in pascals. npAP = npAP * 100 npAP = metro_util.interpolate(self.npTime, npAP) wf_interpolated_data.append_matrix_col('AP', npAP)
def __interpolate_ST(self, ro_controlled_data, ro_interpolated_data): """ Name: __interpolate_ST Parameters:[I] metro_data ro_controlled_data : controlled data. Read-only [I] metro_data ro_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Does the interpolation of road temperature Revision History: Author Date Reason Miguel Tremblay August 11th 2004 """ npTimeOrig = ro_controlled_data.get_matrix_col('Time') npST = ro_controlled_data.get_matrix_col('ST') npST = metro_util.interpolate(npTimeOrig, npST) ro_interpolated_data.append_matrix_col('ST', npST)
def __interpolate_TD(self, ro_controlled_data, ro_interpolated_data): """ Name: __interpolate_TD Parameters:[I] metro_data ro_controlled_data : controlled data.Read-only [I] metro_data ro_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Does the interpolation of the dew point Revision History: Author Date Reason Miguel Tremblay August 5th 2004 """ npTimeOrig = ro_controlled_data.get_matrix_col('Time') npTD = ro_controlled_data.get_matrix_col('TD') npTD = metro_util.interpolate(npTimeOrig, npTD) ro_interpolated_data.append_matrix_col('TD', npTD)
def __interpolate_FA(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_FA Parameters:[I] metro_data wf_originpl_data : originpl data. Read-only [I] metro_data wf_processed_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Does the interpolation of the anthropogenic flux Revision History: Author Date Reason Rok Krsmanc October 22th 2010 """ if metro_config.get_value('FA') == True: npFA = wf_originpl_data.get_matrix_col('FA') # If anthropogenic flux is not specified, FA is set to a constant value of 10 W/m^2 else: lFA = [10] npFA = numpy.array(lFA) npFA = metro_util.interpolate(self.npTime, npFA) wf_interpolated_data.append_matrix_col('FA', npFA)
def __interpolate_PI(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_PI Parameters:[I] metro_data wf_originpl_data : originpl data. Read-only [I] metro_data wf_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col numpy.where, around Description: Interpolate the type of precipitation. The nearest neighbor is is used. Revision History: Author Date Reason Miguel Tremblay July 15th 2004 """ npRA = wf_originpl_data.get_matrix_col('RA') npSN = wf_originpl_data.get_matrix_col('SN') npAT = wf_originpl_data.get_matrix_col('AT') # Replace the last value if they are not good if npRA[len(npRA) - 1] < 0: npRA[len(npRA) - 1] = npRA.max() if npSN[len(npSN) - 1] < 0: npSN[len(npSN) - 1] = npSN.max() npDiffRA = npRA - metro_util.shift_right(npRA, 0) npDiffSN = npSN - metro_util.shift_right(npSN, 0) lPI = [] for i in range(0, len(npDiffRA)): if npDiffRA[i] > 0: lPI.append(1) elif npDiffSN[i] > 0: lPI.append(2) elif npAT[i] > 0: lPI.append(1) else: lPI.append(2) npPI = numpy.array(lPI) # Interpolate npPI = metro_util.interpolate(self.npTime, npPI) # Round npPI = numpy.around(npPI) # Store wf_interpolated_data.append_matrix_col('PI', npPI)
def __interpolate_PI(self, wf_originpl_data, wf_interpolated_data): """ Name: __interpolate_PI Parameters:[I] metro_data wf_originpl_data : originpl data. Read-only [I] metro_data wf_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col numpy.where, around Description: Interpolate the type of precipitation. The nearest neighbor is is used. Revision History: Author Date Reason Miguel Tremblay July 15th 2004 """ npRA = wf_originpl_data.get_matrix_col('RA') npSN = wf_originpl_data.get_matrix_col('SN') npAT = wf_originpl_data.get_matrix_col('AT') # Replace the last value if they are not good if npRA[len(npRA)-1] < 0: npRA[len(npRA)-1] = npRA.max() if npSN[len(npSN)-1] < 0: npSN[len(npSN)-1] = npSN.max() npDiffRA = npRA - metro_util.shift_right(npRA, 0) npDiffSN = npSN - metro_util.shift_right(npSN, 0) lPI = [] for i in range(0, len(npDiffRA)): if npDiffRA[i] > 0: lPI.append(1) elif npDiffSN[i] > 0: lPI.append(2) elif npAT[i] > 0: lPI.append(1) else: lPI.append(2) npPI = numpy.array(lPI) # Interpolate npPI = metro_util.interpolate(self.npTime, npPI) # Round npPI = numpy.around(npPI) # Store wf_interpolated_data.append_matrix_col('PI', npPI)
def __interpolate_validatation(self,ro_controlled_data, observation_data): """ Name: __interpolate_validatation Parameters:[I] metro_data ro_controlled_data : controlled data. Read-only [I] metro_data ro_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, observation_data.get_attribute observation_data.set_attribute numpy.around Description: Does the interpolation of all the attributes that were set in metro_preprocess_qa_qc_observation """ npTimeOrig = ro_controlled_data.get_matrix_col('Time') npSST = observation_data.get_attribute('SST_VALID') npAT = observation_data.get_attribute('AT_VALID') npTD = observation_data.get_attribute('TD_VALID') npWS = observation_data.get_attribute('WS_VALID') # Interpolate npSST = metro_util.interpolate(npTimeOrig, npSST) npAT = metro_util.interpolate(npTimeOrig, npAT) npTD = metro_util.interpolate(npTimeOrig, npTD) npWS = metro_util.interpolate(npTimeOrig, npWS) # Round npTD = numpy.floor(npTD) npAT = numpy.floor(npAT) npSST = numpy.floor(npSST) npWS = numpy.floor(npWS) # Store observation_data.set_attribute('TD_VALID_INTERPOLATED', npTD) observation_data.set_attribute('AT_VALID_INTERPOLATED', npAT) observation_data.set_attribute('SST_VALID_INTERPOLATED', npSST) observation_data.set_attribute('WS_VALID_INTERPOLATED', npWS)
def __interpolate_validatation(self, ro_controlled_data, observation_data): """ Name: __interpolate_validatation Parameters:[I] metro_data ro_controlled_data : controlled data. Read-only [I] metro_data ro_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, observation_data.get_attribute observation_data.set_attribute numpy.around Description: Does the interpolation of all the attributes that were set in metro_preprocess_qa_qc_observation """ npTimeOrig = ro_controlled_data.get_matrix_col('Time') npSST = observation_data.get_attribute('SST_VALID') npAT = observation_data.get_attribute('AT_VALID') npTD = observation_data.get_attribute('TD_VALID') npWS = observation_data.get_attribute('WS_VALID') # Interpolate npSST = metro_util.interpolate(npTimeOrig, npSST) npAT = metro_util.interpolate(npTimeOrig, npAT) npTD = metro_util.interpolate(npTimeOrig, npTD) npWS = metro_util.interpolate(npTimeOrig, npWS) # Round npTD = numpy.floor(npTD) npAT = numpy.floor(npAT) npSST = numpy.floor(npSST) npWS = numpy.floor(npWS) # Store observation_data.set_attribute('TD_VALID_INTERPOLATED', npTD) observation_data.set_attribute('AT_VALID_INTERPOLATED', npAT) observation_data.set_attribute('SST_VALID_INTERPOLATED', npSST) observation_data.set_attribute('WS_VALID_INTERPOLATED', npWS)
def __set_ir(self, wf_controlled_data, wf_interpolated_data): """ Set the theoretical infrared flux. Parameters: wf_controlled_data (metro_data) : controlled data. Read-only """ npTime = wf_controlled_data.get_matrix_col('Time') # Only interpolate if IR is given if metro_config.get_value('IR'): npIR = wf_controlled_data.get_matrix_col('IR') npIR2 = metro_util.interpolate(npTime, npIR) wf_interpolated_data.append_matrix_col('IR', npIR2) return npCloudOctal = wf_controlled_data.get_matrix_col('CC') (npCoeff1, npCoeff2) = metro_physics.get_cloud_coefficient(npCloudOctal) npAT = wf_controlled_data.get_matrix_col('AT') npIR = npCoeff1*npAT+npCoeff2 npIR2 = metro_util.interpolate(npTime, npIR) wf_controlled_data.append_matrix_col('IR', npIR) wf_interpolated_data.append_matrix_col('IR', npIR2)
def __interpolate_FT(self, wf_original_data, wf_controlled_data, \ wf_interpolated_data): """ Name: __interpolate_FT Parameters:[I] metro_data wf_original_data : original data. Read-only [I] metro_data wf_processed_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Interpolate forcast time. Copy self.npTime in wf_processed_data 'FORECAST_TIME' Revision History: Author Date Reason Miguel Tremblay July 13th 2004 """ npFT = wf_original_data.get_matrix_col('FORECAST_TIME') npFT = metro_util.interpolate(self.npTime, npFT) wf_interpolated_data.append_matrix_col('FORECAST_TIME', npFT) nHourStart = int(metro_date.get_hour(npFT[0])) # A strange trick of copying the NumPy array locally to set it in the matrix # must be done (if I remember well), because otherwhise the array are not included # in the matrix. It might be because NumPy made use of pointers. npTime = self.npTime wf_controlled_data.append_matrix_col('Time', npTime) npTime = metro_util.interpolate(self.npTime, npTime) npTime = (npTime+30)/3600+nHourStart wf_interpolated_data.append_matrix_col('Time', npTime)
def __interpolate_FT(self, wf_original_data, wf_controlled_data, \ wf_interpolated_data): """ Name: __interpolate_FT Parameters:[I] metro_data wf_original_data : original data. Read-only [I] metro_data wf_processed_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Interpolate forcast time. Copy self.npTime in wf_processed_data 'FORECAST_TIME' Revision History: Author Date Reason Miguel Tremblay July 13th 2004 """ npFT = wf_original_data.get_matrix_col('FORECAST_TIME') npFT = metro_util.interpolate(self.npTime, npFT) wf_interpolated_data.append_matrix_col('FORECAST_TIME', npFT) nHourStart = int(metro_date.get_hour(npFT[0])) # A strange trick of copying the NumPy array locally to set it in the matrix # must be done (if I remember well), because otherwhise the array are not included # in the matrix. It might be because NumPy made use of pointers. npTime = self.npTime wf_controlled_data.append_matrix_col('Time', npTime) npTime = metro_util.interpolate(self.npTime, npTime) npTime = (npTime + 30) / 3600 + nHourStart wf_interpolated_data.append_matrix_col('Time', npTime)
def __set_ir(self, wf_controlled_data, wf_interpolated_data): """ Set the theoretical infrared flux. Parameters: wf_controlled_data (metro_data) : controlled data. Read-only """ npTime = wf_controlled_data.get_matrix_col('Time') # Only interpolate if IR is given if metro_config.get_value('IR'): npIR = wf_controlled_data.get_matrix_col('IR') npIR2 = metro_util.interpolate(npTime, npIR) wf_interpolated_data.append_matrix_col('IR', npIR2) return npCloudOctal = wf_controlled_data.get_matrix_col('CC') (npCoeff1, npCoeff2) = metro_physics.get_cloud_coefficient(npCloudOctal) npAT = wf_controlled_data.get_matrix_col('AT') npIR = npCoeff1 * npAT + npCoeff2 npIR2 = metro_util.interpolate(npTime, npIR) wf_controlled_data.append_matrix_col('IR', npIR) wf_interpolated_data.append_matrix_col('IR', npIR2)
def __set_cc(self, wf_controlled_data, wf_interpolated_data): """ In the case that SF and IR are given, put the values of CC to -1. Parameters: wf_controlled_data (metro_data) : controlled data. Read-only """ if metro_config.get_value('SF') and metro_config.get_value('IR'): npTime = wf_controlled_data.get_matrix_col('Time') npCloudOctal = wf_controlled_data.get_matrix_col('CC') nLength = len(npCloudOctal) npCloud = numpy.ones(nLength) * (-1) npCloud2 = metro_util.interpolate(npTime, npCloud) wf_controlled_data.set_matrix_col('CC', npCloud) wf_interpolated_data.set_matrix_col('CC', npCloud2)
def __interpolate_AT(self, ro_controlled_data, ro_interpolated_data): """ Name: __interpolate_AT Parameters:[I] metro_data ro_controlled_data : controlled data. Read-only [I] metro_data ro_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col Description: Does the interpolation of the air temperature """ npTimeOrig = ro_controlled_data.get_matrix_col('Time') npAT = ro_controlled_data.get_matrix_col('AT') npAT = metro_util.interpolate(npTimeOrig, npAT) ro_interpolated_data.append_matrix_col('AT', npAT)
def __interpolate_SC(self, ro_controlled_data, ro_interpolated_data): """ Name: __interpolate_SC Parameters:[I] metro_data ro_controlled_data : controlled data. Read-only [I] metro_data ro_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col numpy.where, around Description: Does the interpolation of the Road Condition 33 is the SSI code. SEE the documentation for the conversion between this code and the other standard: http://documentation.wikia.com/wiki/Road_condition_%28METRo%29 Revision History: Author Date Reason Miguel Tremblay August 12th 2004 """ npTimeOrig = ro_controlled_data.get_matrix_col('Time') npSC = ro_controlled_data.get_matrix_col('SC') # Convert npSC = numpy.where(npSC == 33, 0, 1) npSC = numpy.where(npSC < 0, 0, npSC) npSC = numpy.where(npSC > 1, 0, npSC) npSC = metro_util.interpolate(npTimeOrig, npSC) # Round npSC = numpy.around(npSC) # Store ro_interpolated_data.append_matrix_col('SC', npSC)
def __interpolate_SC(self, ro_controlled_data, ro_interpolated_data): """ Name: __interpolate_SC Parameters:[I] metro_data ro_controlled_data : controlled data. Read-only [I] metro_data ro_interpolated_data : container of the interpolated data. Returns: None Functions Called: metro_util.interpolate, metro_data.get_matrix_col metro_data.append_matrix_col numpy.where, around Description: Does the interpolation of the Road Condition 33 is the SSI code. SEE the documentation for the conversion between this code and the other standard: https://framagit.org/metroprojects/metro/wikis/Road_condition_(METRo) Revision History: Author Date Reason Miguel Tremblay August 12th 2004 """ npTimeOrig = ro_controlled_data.get_matrix_col('Time') npSC = ro_controlled_data.get_matrix_col('SC') # Convert npSC = numpy.where(npSC == 33, 0, 1) npSC = numpy.where(npSC < 0, 0, npSC) npSC = numpy.where(npSC > 1, 0, npSC) npSC = metro_util.interpolate(npTimeOrig, npSC) # Round npSC = numpy.around(npSC) # Store ro_interpolated_data.append_matrix_col('SC', npSC)