void linear_interpolation(const VectorScalar &temp0, const VectorScalar &alt0, const VectorScalar &alt1, VectorScalar &temp1) { unsigned int j(0); typename Antioch::value_type<VectorScalar>::type a; typename Antioch::value_type<VectorScalar>::type b; temp1.resize(alt1.size()); for(unsigned int iz = 0; iz < alt1.size(); iz++) { while(alt0[j] < alt1[iz]) { j++; if(!(j < alt0.size()))break; } if(j == 0) { Antioch::set_zero(a); b = temp0[j]; }else if(j < alt0.size() - 1) { a = (temp0[j] - temp0[j-1])/(alt0[j] - alt0[j-1]); b = temp0[j] - a * alt0[j]; }else { Antioch::set_zero(a); b = temp0.back(); } temp1[iz] = a * alt1[iz] + b; } }
void read_hv_flux(VectorScalar &lambda, VectorScalar &phy1AU, const std::string &file) { std::string line; std::ifstream flux_1AU(file); getline(flux_1AU,line); while(!flux_1AU.eof()) { Scalar wv,ir,dirr; flux_1AU >> wv >> ir >> dirr; if(!lambda.empty() && wv == lambda.back())continue; lambda.push_back(wv);//nm phy1AU.push_back(ir);//W/m2/nm } flux_1AU.close(); return; }