Пример #1
0
void CorrectorClim::correctCore(const Parameters& iParameters, Ensemble& iEnsemble) const {
   float climWeight = iParameters[0];
   float ensWeight = 1 - climWeight;
   float clim;
   if(mComputeClim) {
      assert(iParameters.size() == 2);
      clim = iParameters[1];
   }
   else
      clim = mData.getClim(iEnsemble.getDate(), iEnsemble.getInit(), iEnsemble.getOffset(),
            iEnsemble.getLocation(), iEnsemble.getVariable());
   if(Global::isValid(clim) && Global::isValid(ensWeight) && Global::isValid(climWeight)) {
      for(int n = 0; n < iEnsemble.size(); n++) {
         float currValue = iEnsemble[n];
         if(Global::isValid(currValue)) {
            iEnsemble[n] = currValue * ensWeight + clim * climWeight;
         }
      }
   }
}
Пример #2
0
float MeasureLocalGradient::measureCore(const Ensemble& iEnsemble) const {
   int   date   = iEnsemble.getDate();
   int init     = iEnsemble.getInit();
   float offset = iEnsemble.getOffset();
   Location loc = iEnsemble.getLocation();

   // Determine which variable to use
   std::string var = mVariable;
   if(mVariable == "") {
      var = iEnsemble.getVariable();
   }

   std::string dataset = loc.getDataset();
   float centerValue = iEnsemble.getMoment(1);

   // Get nearby locations
   Input* input = mData.getInput(dataset);
   std::vector<Location> nearbyLocations;
   input->getSurroundingLocations(loc, nearbyLocations, 4);

   // Compute gradient
   float grad;
   int counter = 0;
   for(int i = 0; i < (int) nearbyLocations.size(); i++) {
      Ensemble ens;
      mData.getEnsemble(date, init, offset, nearbyLocations[i], dataset, var, ens);
      float mean = ens.getMoment(1);
      if(Global::isValid(mean)) {
         // TODO
         float dist = 0;
         float dvdx = 0;
         float dydy = 0;
         counter++;
      }
   }

   return iEnsemble.getMoment(2);
}
Пример #3
0
Файл: Qc.cpp Проект: WFRT/Comps
bool Qc::qc(Ensemble& iEnsemble) const {
   bool anyChanges = false;
   for(int i = 0; i < iEnsemble.size(); i++) {
      if(!check(Value(iEnsemble[i], iEnsemble.getDate(), iEnsemble.getInit(), iEnsemble.getOffset(), iEnsemble.getLocation(), iEnsemble.getVariable()))) {
         anyChanges = true;
         iEnsemble[i] = Global::MV;
      }
   }
   return anyChanges;
}