Commit fe0e7dd9 authored by Miguel Tremblay's avatar Miguel Tremblay
Browse files

Remove the code for the coupling with no observation. The preprocess handle...

Remove the code for the coupling with no observation. The preprocess handle this and it is impossible for the C code to "this" possibility.

parent d5ccd404
......@@ -265,7 +265,7 @@ class Metro_model(Metro_module):
npSWO[4*i+3] = npSWO4[i]
lSWO = npSWO.astype(numpy.int32).tolist()
bNoObs = observation.get_attribute('NO_OBS')
bThreeHoursObs = observation.get_attribute('THREE_HOURS_OBS')
sMessage = _( "------------station config START---------------------")
metro_logger.print_message(metro_logger.LOGGER_MSG_DEBUG,
......@@ -287,6 +287,9 @@ class Metro_model(Metro_module):
bFlat = cs_data.get_station_type()
metro_logger.print_message(metro_logger.LOGGER_MSG_DEBUG,
sMessage)
sMessage = _("------------station config END---------------------")
metro_logger.print_message(metro_logger.LOGGER_MSG_DEBUG,
sMessage)
......@@ -302,9 +305,10 @@ class Metro_model(Metro_module):
lLayerThick, nNbrOfLayer, lLayerType, \
lAT, lQP, lWS, lAP, lSF, lIR, lFT, lFA, lPI, lSC,\
lAT_obs,lST_obs, lSST_obs, \
lAH, lTime_obs, lSWO, bNoObs,\
lAH, lTime_obs, lSWO, \
fDeltaTMetroObservation, nLenObservation, \
nNbrTimeSteps, bSilent)
nNbrTimeSteps, bSilent, \
bThreeHoursObs)
bEchec = (macadam.get_echec())[0]
# Check if the execution of the model was a succes:
if bEchec != 0:
......
......@@ -409,30 +409,19 @@ class Metro_preprocess_qa_qc_observation(Metro_preprocess):
"""
# Take any of the column of the observation to check the dimensions.
npAT = ro_controlled_data.get_matrix_col('AT')
npTime = ro_controlled_data.get_matrix_col('Time')
nNbr30Seconds = (npTime[len(npTime)-1]-npTime[0]) \
/metro_constant.fTimeStep
# Initialize the boolean field
bNoObs = [0, 0, 0, 0]
bThreeHoursObs = True
# Check if there is any data for initialisation
fDeltaT = observation_data.get_attribute('DELTA_T')
# No intersection between the forecast and the obsevations
if fDeltaT <= 0:
bNoObs[0] = 1
# Less than 3 hours of observation (3*3600/30 = 360)
if nNbr30Seconds < 360:
bNoObs[1] = 1
# No valid observation
if len(npAT) == 0:
bNoObs[2] = 1
# One valid observation
if len(npAT) == 1:
bNoObs[3] = 1
bThreeHoursObs = False
# Set the variable
observation_data.set_attribute('NO_OBS',bNoObs)
observation_data.set_attribute('THREE_HOURS_OBS',bThreeHoursObs)
def __set_time_difference(self, ro_controlled_data, wf_controlled_data, \
......
......@@ -386,11 +386,12 @@ def save_command_line_parameter( lArgv, sShort_opt, lLong_opt ):
if o == "--use-anthropogenic-flux":
dConfig['FA']['VALUE'] = True
dSFDict= {'NAME':"FA",
dFSDict= {'NAME':"FA",
'XML_TAG':"fa",
'DATA_TYPE':"REAL"}
dConfig['XML_FORECAST_PREDICTION_EXTENDED_ITEMS'][\
'VALUE'].append(dSFDict)
'VALUE'].append(dFSDict)
if o == "--output-subsurface-levels":
dConfig['TL']['VALUE'] = True
......@@ -408,7 +409,6 @@ def save_command_line_parameter( lArgv, sShort_opt, lLong_opt ):
'VALUE'].append(dTL)
# Selftest value
if o == "--selftest":
......@@ -856,7 +856,6 @@ def set_default_value( ):
'FROM' :CFG_INTERNAL,
'COMMENTS' :_("standard station header items")}
dConfig['XML_STATION_HEADER_EXTENDED_ITEMS'] = \
{'VALUE' :[],
'FROM' :CFG_HARDCODED,
......@@ -949,7 +948,7 @@ def set_default_value( ):
dConfig['XML_ROADCAST_HEADER_EXTENDED_ITEMS'] = \
{'VALUE' :[],
'FROM' :CFG_HARDCODED,
'FROM' :CFG_INTERNAL,
'COMMENTS' :_("extended roadcast header items")}
dConfig['XML_ROADCAST_PREDICTION_STANDARD_ITEMS'] = \
......@@ -1085,7 +1084,7 @@ def set_default_value( ):
"TD_VALID_INTERPOLATED",
"WS_VALID_INTERPOLATED",
"DELTA_T",
"NO_OBS"
"THREE_HOURS_OBS"
],
'FROM' :CFG_INTERNAL,
'COMMENTS' :_("default observation attribute.")}
......
......@@ -117,6 +117,8 @@ static struct doubleStruct stLT; /* Level temperature */
and the start of METRo.]
[I long nLenObservation : Number of valid observations. 30 seconds steps.]
[I long nNbrTimeSteps : number of 30 seconds steps in the forecast]
[I long bThreeHoursObs: True if the number of observations is over 3 hours ]
Returns: None
......@@ -143,7 +145,7 @@ Miguel Tremblay May 2004
***************************************************************************/
void Do_Metro( BOOL bFlat, double dMLat, double dMLon, double* dpZones, long nNbrOfZone, long* npMateriau, double* dpTA, double* dpQP, double* dpFF, double* dpPS, double* dpFS, double* dpFI, double* dpFT, double* dpFA, double* dpTYP, double* dpRC, double* dpTAO, double* dpRTO, double* dpDTO, double* dpAH, double* dpTimeO, long* npSwo, BOOL* bpNoObs, double dDeltaT, long nLenObservation, long nNbrTimeSteps, BOOL bSilent)
void Do_Metro( BOOL bFlat, double dMLat, double dMLon, double* dpZones, long nNbrOfZone, long* npMateriau, double* dpTA, double* dpQP, double* dpFF, double* dpPS, double* dpFS, double* dpFI, double* dpFT, double* dpFA, double* dpTYP, double* dpRC, double* dpTAO, double* dpRTO, double* dpDTO, double* dpAH, double* dpTimeO, long* npSwo, double dDeltaT, long nLenObservation, long nNbrTimeSteps, BOOL bSilent, BOOL bThreeHoursObs)
{
/* Argument de la ligne de commande. Donne par python */
......@@ -245,30 +247,17 @@ void Do_Metro( BOOL bFlat, double dMLat, double dMLon, double* dpZones, long nNb
/***********************************************************************/
/* Couplage de la prevision et des observations.
/* Differentes possibilites selon la quantite d'observations
/* presentes.
/* Coupling is different if there is more or less than 3 hours.
/**********************************************************************/
bFail = FALSE;
if(bpNoObs[2]){
goto liberation;
}
else if(bpNoObs[3]){
BOOL bFalse = FALSE;
if(!bSilent)
printf(" Only one valid observation: No initialization nor coupling.\n");
f77name(makitp)(dpItp, &stTemperatureDepth.nSize, &nIR40, &bFlat,\
&(dpTimeO[0]), &(dpRTO[0]), &(dpDTO[0]), &(dpTAO[0]),\
&dDiff, &dMLon, npSwo, stTemperatureDepth.pdArray);
nNtp2 = nLenObservation - nDeltaTIndice;
}
else if(bpNoObs[1]){
if( !bThreeHoursObs){
/* less than 3 hours of observation in the coupling */
BOOL bFalse = FALSE;
long nOne =1;
if(!bSilent)
printf(" Not enough data for coupling.\n");
f77name(makitp)(dpItp, &stTemperatureDepth.nSize, &nIR40, &bFlat, &(dpTimeO[0]),\
f77name(makitp)(dpItp, &stTemperatureDepth.nSize, &nIR40, &bFlat, \
&(dpTimeO[0]), \
&(dpRTO[0]), &(dpDTO[0]), &(dpTAO[0]), &dDiff, \
&dMLon, npSwo, stTemperatureDepth.pdArray);
f77name(initial)(dpItp , (dpRTO+1), (dpDTO+1), (dpTAO+1), &nOne, \
......@@ -276,44 +265,6 @@ void Do_Metro( BOOL bFlat, double dMLat, double dMLon, double* dpZones, long nNb
&bFlat, npSwo, dpCapacity, dpConductivity);
nNtp2 = nLenObservation - nDeltaTIndice;
}
else if(bpNoObs[0]){
BOOL bTmp = FALSE;
if(!bSilent)
printf(" Not enough data for initialization.\n");
nNtdcl = nLenObservation - ((nLenObservation < 28800.0/dDT)\
? nLenObservation : 28800.0/dDT);
/* Patch because nNtdcl does not take the value 0 in fortran!*/
if(nNtdcl == 0)
nNtdcl =1;
f77name(makitp)(dpItp, &stTemperatureDepth.nSize, &nIR40, &bFlat, &(dpTimeO[nNtdcl]),\
&(dpRTO[nNtdcl]), &(dpDTO[nNtdcl]), &(dpTAO[nNtdcl]),\
&dDiff, &dMLon, npSwo, stTemperatureDepth.pdArray);
nNtp = - nDeltaTIndice + nNtdcl;
nNtp2 = nLenObservation - nDeltaTIndice;
f77name(coupla)(dpFS, dpFI, dpPS, dpTA, dpAH, dpFF, dpTYP, dpFT, dpQP, dpRC, \
&stTemperatureDepth.nSize, &nNtp, &nNtp2, dpItp, \
&(dpRTO[nLenObservation]), &bFlat, &dFCorr, dpWw, \
&dAln, &dAlr, &dFp, &dFsCorr, &dFiCorr, &dEr1, &dEr2, \
&bFail, &dEpsilon, &dZ0, &dZ0t, &dZu, &dZt, stEc.plArray, \
stRA.pdArray, stSN.pdArray, stRC.plArray, stRT.pdArray,\
stIR.pdArray, stSF.pdArray, stFV.pdArray, stFC.pdArray, \
dpFA, stG.pdArray, stBB.pdArray, stFP.pdArray,\
dpCapacity, dpConductivity);
if(!bSilent)
printf("coupla 1 \n");
if(*(stEc.plArray)){
bSucces = FALSE;
goto liberation;
}
if(bFail){
long nOne = 1;
if(!bSilent)
printf("fail\n");
f77name(initial)(dpItp, (dpRTO+1), (dpDTO+1), (dpTAO+1), &nOne,\
&nLenObservation, &stTemperatureDepth.nSize,\
&nIR40, &bFlat, npSwo, dpCapacity, dpConductivity);
}
}
else{/* observation complete */
long nOne =1;
if(!bSilent)
......
......@@ -36,7 +36,7 @@
#define dPI 3.141592653590e0
#define dOMEGA 0.7292e-4
void Do_Metro(BOOL bFlat, double dMLat, double dMLon, double* dpZones, long nNbrOfZone, long* npMateriau, double* dpTA, double* dpQP, double* dpFF, double* dpPS, double* dpFsPy, double* dpFI, double* dpFT, double* dpFA, double* dpTYP, double* dpRc, double* dpTAO, double* dpRTO, double* dpDTO, double* dpAH, double* dpTimeO, long* npSWO, BOOL* bpNoObs, double dDeltaT, long nLenObservation, long nNbrTimeSteps, BOOL bSilent);
void Do_Metro(BOOL bFlat, double dMLat, double dMLon, double* dpZones, long nNbrOfZone, long* npMateriau, double* dpTA, double* dpQP, double* dpFF, double* dpPS, double* dpFsPy, double* dpFI, double* dpFT, double* dpFA, double* dpTYP, double* dpRc, double* dpTAO, double* dpRTO, double* dpDTO, double* dpAH, double* dpTimeO, long* npSWO, double dDeltaT, long nLenObservation, long nNbrTimeSteps, BOOL bSilent, BOOL bThreeHoursObs);
void init_structure(long nTimeStepMax, long nGrilleLevelMax);
......
......@@ -390,7 +390,7 @@ int print_args(char **argv) {
extern void Do_Metro(long, double, double, double*, long, long*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, long*, long*, double, long, long, long);
extern void Do_Metro(long, double, double, double*, long, long*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, long*, double, long, long, long, long);
extern struct doubleStruct get_ra(void);
extern struct doubleStruct get_sn(void);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment