void TestIfInRange(VarDesc *v, double tmp) { static VarDesc *vstat = NULL; static int vcount = 0; if (v != vstat) { vstat = v; vcount = 0; } if (tmp != -999. && (tmp < v->rmin || tmp > v->rmax) && vcount < 12) { if (vcount == 11) InputError(ERROR, "and more..."); else InputError(ERROR, "Variable %s (%.2lg) in netCDF is out of range (%.2lg - %.2lg).", v->name, tmp, v->rmin, v->rmax); inputerror = 1; vcount++; } }
std::tuple<std::shared_ptr<mpqc::KeyVal>,KeyVal::InputFormat> make_keyval(madness::World &world, const std::string &filename) { std::shared_ptr<mpqc::KeyVal> kv; using InputFormat = KeyVal::InputFormat; InputFormat input_format; try { kv = __make_keyval(world, filename, InputFormat::json); input_format = InputFormat::json; } catch (...) { } if (input_format == InputFormat::invalid) { try { kv = __make_keyval(world, filename, InputFormat::xml); input_format = InputFormat::xml; } catch (std::exception &e) { } } if (input_format == InputFormat::invalid) { try { kv = __make_keyval(world, filename, InputFormat::info); input_format = InputFormat::info; } catch (...) { std::cerr << "failed read_info" << std::endl; } } if (input_format == InputFormat::invalid) throw InputError( "did not recognize input file format (recognized formats: JSON, XML, " "INFO)", __FILE__, __LINE__); return std::make_tuple(kv, input_format); }
static void ReadCFGHeader() { ReadFileHeader(fileID, currentCfgFileReadMajorVersion, currentCfgFileReadMinorVersion, "nPre configuration"); if (currentCfgFileReadMajorVersion < 0) InputError("Bad version #"); if (currentCfgFileReadMajorVersion < 4) { prevVerSystemObjects.Alloc(10); // fix for old ver of sys obj prevVerSystemObjects += &sequenceTimesFO; prevVerSystemObjects += &capturedDataFO; prevVerSystemObjects += &xyForwardOutputFO; prevVerSystemObjects += &profileOutputFO; prevVerSystemObjects += &optimizeInput; prevVerSystemObjects += &optCompleteOutput; prevVerSystemObjects += &optProgressOutput; prevVerSystemObjects += &sampResultsFO; prevVerSystemObjects += &simulatorRadiiFO; } // kluge for os versioning osUseVersionControl = (currentCfgFileReadMajorVersion > 5); ReadAppGlobals(); }
PFModule *SelectTimeStepNewPublicXtra() { PFModule *this_module = ThisPFModule; PublicXtra *public_xtra; Type0 *dummy0; Type1 *dummy1; char *switch_name; NameArray type_na; type_na = NA_NewNameArray("Constant Growth"); public_xtra = ctalloc(PublicXtra, 1); switch_name = GetString("TimeStep.Type"); public_xtra -> type = NA_NameToIndex(type_na, switch_name); switch((public_xtra -> type)) { case 0: { dummy0 = ctalloc(Type0, 1); dummy0 -> step = GetDouble("TimeStep.Value"); (public_xtra -> data) = (void *) dummy0; break; } case 1: { dummy1 = ctalloc(Type1, 1); dummy1 -> initial_step = GetDouble("TimeStep.InitialStep"); dummy1 -> factor = GetDouble("TimeStep.GrowthFactor"); dummy1 -> max_step = GetDouble("TimeStep.MaxStep"); dummy1 -> min_step = GetDouble("TimeStep.MinStep"); (public_xtra -> data) = (void *) dummy1; break; } default: { InputError("Error: invalid type <%s> for key <%s>\n", switch_name, "TimeStep.Type"); } } NA_FreeNameArray(type_na); PFModulePublicXtra(this_module) = public_xtra; return this_module; }
std::string TextIOConsole::prompt_for_string (State* state, int status, std::string prompt_message, size_t max_length) { std::string input; prompt_out << prompt_message << ": "; if (!std::getline(in, input)) throw InputError(); return input.substr(0, max_length); }
int AddClassVal(double val) { if (valuepos >= nclvar) { InputError(ERROR, "Too many numbers on this line."); return (1); } classval[nclass][valuepos++] = val; return (0); }
double TextIOConsole::prompt_for_double (State* state, int status, std::string prompt_message, double min, double max) // TODO: handle min/max { double input; prompt_out << prompt_message << ": "; in >> input; if (!in) throw InputError(); return input; }
int InitializeGroundClasses(void) { if (nclass) { InputError(ERROR, "You can not define Groundclasses twice."); return (1); } classval = (classrow *)calloc(MAXCLASS, sizeof(classrow)); nclass = nclvar = valuepos = 0; return (0); }
static void ReadHeader(const char* fileID, const char* typeID) { int majVer, minVer; ReadFileHeader(fileID, majVer, minVer, typeID); if ((majVer != 0) || (minVer != 0)) InputError("Bad version #"); isCurrentApp = (ReadInt() == GetAppID()); }
int EndOfClassLine(void) { if (valuepos < nclvar) { InputError(ERROR, "Too few numbers on this line."); return (1); } valuepos = 0; nclass++; return (0); }
void read_mapping() { FILE* pfile = fopen(MAPPING_FILENAME, "r"); if (pfile == NULL) { InputError("Unable to open file", MAPPING_FILENAME); } fscanf(pfile, "%d", &num_symbols); int index, symbol_id; int read = fscanf(pfile, "%d %d", &index, &symbol_id); while (read == 2) { mapping[index] = symbol_id; read = fscanf(pfile, "%d %d", &index, &symbol_id); } }
void ReadAndMatchFuncObj(const FuncObjC* currFO) { const FuncObjC* oldThis = ReadFuncObj(); CheckForInputFailure("Reading old object address"); for (int i = 0; i < FuncObjC::updateData.Size(); i++) { const FuncObjC* oldRef = FuncObjC::updateData[i].oldRef; if (oldRef == oldThis) { FuncObjC::updateData[i].newRef = currFO; return; } } InputError("No object address match"); }
void read_rules() { FILE* pfile = fopen(RULES_FILENAME, "r"); if (pfile == NULL) { InputError("Unable to open file", RULES_FILENAME); } fscanf(pfile, "%d", &num_rules); for (int rule_num=0; rule_num<num_rules; rule_num++) { int size; fscanf(pfile, "%d", &size); assert(size < MAX_RULE_LEN-1); rules[rule_num][0] = size; for (int sym_num=1; sym_num<=size; sym_num++) { int symbol; fscanf(pfile, "%d", &symbol); rules[rule_num][sym_num] = symbol; } } }
void Merge::execute(DataProvider& provider) { if (m_list == 0) { Id2DataPair dataMapper(INPUT_NUM_ITEMS); provider.receiveInputData(dataMapper); ReadAccess access(dataMapper.data()); try { m_numItems = toInt(access.get()); } catch (BadCast&) { throw InputError(INPUT_NUM_ITEMS, *this, "Number of items must be an integer."); } m_list = new List(); } if (m_list->content().size() < m_numItems) { RecycleAccess recycler; { Id2DataPair dataMapper(INPUT_DATA); provider.receiveInputData(dataMapper); recycler.add(dataMapper.data()); } Data* data = recycler.get(); m_list->content().push_back(data); } if (m_list->content().size() == m_numItems) { DataContainer out(m_list); m_list = 0; m_numItems = 0; Id2DataPair dataMapper(OUTPUT, out); provider.sendOutputData(dataMapper); } }
void read_table() { FILE* pfile = fopen(TABLE_FILENAME, "r"); if (pfile == NULL) { InputError("Unable to open file", TABLE_FILENAME); } fscanf(pfile, "%d", &num_states); // clear array for (int i=0; i<num_states; i++) for (int j=0; j<num_symbols; j++) table[i][j].action = 'e'; int read, state, symbol, attr; char act; read = fscanf(pfile, "%d %d %c %d", &state, &symbol, &act, &attr); while (read == 4) { table[state][symbol].action = act; table[state][symbol].attr = attr; read = fscanf(pfile, "%d %d %c %d", &state, &symbol, &act, &attr); } }
void Split::execute(DataProvider& provider) { if (m_storedItems.size() == 0) { RecycleAccess recycle; { Id2DataPair input(INPUT); provider.receiveInputData(input); recycle.add(input.data()); } Data* data = recycle.get(); List* list = data_cast<List>(data); if (list == 0) throw InputError(INPUT, *this, "Input data must be a 'List' object."); for (std::vector<Data*>::iterator iter = list->content().begin(); iter != list->content().end(); ++iter) { m_storedItems.push_back(DataContainer(*iter)); } uint64_t size = list->content().size(); list->content().clear(); delete list; DataContainer outNumItems(new UInt64(size)); Id2DataPair dataMapper(OUTPUT_NUM_ITEMS, outNumItems); provider.sendOutputData(dataMapper); } if (m_storedItems.size() != 0) { DataContainer outData = m_storedItems.front(); Id2DataPair dataMapper(OUTPUT_DATA, outData); m_storedItems.pop_front(); provider.sendOutputData(dataMapper); } }
OzoneBands::OzoneBands(int nw_in, const double *wl_in) { #include "ph_o3data.c" nw = nw_in; wl = wl_in; if (!(xso3 = new double[nw]) || !(s226 = new double[nw]) || !(s263 = new double[nw]) || !(s298 = new double[nw])) { InputError(ERROR, "Unable to allocate memory in \"OzoneBands\"."); exit (3); } Rebin(NXO3, xwl, xtpl, nw, wl, xso3); Rebin(NSO3, swl, s226tpl, nw, wl, s226); Rebin(NSO3, swl, s263tpl, nw, wl, s263); Rebin(NSO3, swl, s298tpl, nw, wl, s298); for (int i = nw; i--; ) { const double sfct = 1.e-20; s226[i] *= sfct; s263[i] *= sfct; s298[i] *= sfct; } }
void ConvertPixelType::execute(DataProvider& provider) { if (m_dataFlow == MANUAL) { Id2DataPair srcMapper(SOURCE); Id2DataPair destMapper(DESTINATION); provider.receiveInputData(srcMapper && destMapper); if(srcMapper.data() == destMapper.data()) throw InputError(DESTINATION, *this, "Destination image must not be the same image as the source image."); ReadAccess src(srcMapper.data()); WriteAccess dest(destMapper.data()); const runtime::Image& srcImage = src.get<runtime::Image>(); runtime::Image& destImage = dest.get<runtime::Image>(); runtime::Image::PixelType pixelType = runtime::Image::PixelType((unsigned int)(m_pixelType)); unsigned int destImageSize = srcImage.width() * srcImage.height() * getDestPixelSize(pixelType); unsigned int destImageStride = srcImage.width() * getDestPixelSize(pixelType); if(destImage.bufferSize() < destImageSize) throw InputError(DESTINATION, *this, "Destination image is too small."); destImage.initializeImage(srcImage.width(), srcImage.height(), destImageStride, destImage.buffer(), pixelType); if((srcImage.pixelType() == runtime::Image::RGB_24 || srcImage.pixelType() == runtime::Image::BGR_24) && (pixelType == runtime::Image::BAYERBG_8 || pixelType == runtime::Image::BAYERGB_8)) { // this case is not handled by OpenCV rgbToBayer(srcImage, destImage); } else { // use OpenCV for conversion openCvConversion(srcImage, destImage); } Id2DataPair outputMapper(OUTPUT, destMapper.data()); provider.sendOutputData( outputMapper); } else // allocate destination data on the fly { Id2DataPair srcMapper(SOURCE); provider.receiveInputData(srcMapper); ReadAccess src(srcMapper.data()); const runtime::Image& srcImage = src.get<runtime::Image>(); runtime::Image::PixelType pixelType = runtime::Image::PixelType((unsigned int)(m_pixelType)); runtime::Image* destImage = new cvsupport::Image(srcImage.width(), srcImage.height(), pixelType); DataContainer destContainer(destImage); if((srcImage.pixelType() == runtime::Image::RGB_24 || srcImage.pixelType() == runtime::Image::BGR_24) && (pixelType == runtime::Image::BAYERBG_8 || pixelType == runtime::Image::BAYERGB_8)) { // this case is not handled by OpenCV rgbToBayer(srcImage, *destImage); } else { // use OpenCV for conversion openCvConversion(srcImage, *destImage); } Id2DataPair outputMapper(OUTPUT, destContainer); provider.sendOutputData( outputMapper); } }
void appCopyPaste::PastePages() { bool fileReadOK = false; MenuPageArray pagesRead(16); int nObjects; try { appConfigFile::OpenAsClipboard(true); // header ReadPageHeader(); int nPages = ReadInt(); int ntotalPages = ReadInt(); nObjects = ReadInt(); if (nPages == 0) InputError("No pages ??"); // check that all page types are supported char tempStr[160]; for (int i = 0; i < ntotalPages; i++) { ReadText(tempStr, 160); if (!AllocPageC::MenuPageExists(tempStr)) InputError("Page type not supported by application"); } // and all object types for (int i = 0; i < nObjects; i++) { ReadText(tempStr, 160); if (!AllocObjC::MenuObjectExists(tempStr)) InputError("Object type not supported by application"); } AppMenuC::GetApp().PrePasteSetup(); // read app globals ReadAppGlobals(); // read pages pagesRead.Alloc(nPages); for (int i = 0; i < nPages; i++) { ReadText(tempStr, 160); // convert to page type if (!AllocPageC::MenuPageExists(tempStr)) InputError("Page type conversion error ??"); // create new page MenuPageC* newPage = AllocPageC::CreateMenuPage(tempStr); bool childOK = (MenuPageC::currPageObj == 0) || MenuPageC::currPageObj->AcceptAsChild(*newPage); // test to see if it can be added as child of current page if (childOK && newPage->AcceptAsParent(MenuPageC::currPageObj)) { // parent OK -- finish up newPage->ParentChanging(MenuPageC::currPageObj); if (MenuPageC::currPageObj != 0) { MenuPageC::currPageObj->childPages += newPage; MenuPageC::currPageObj->ResetChildren(); } } else if (!newPage->AcceptAsParent(NULL)) { delete newPage; InputError("Page type cannot be pasted"); } // add it to list pagesRead.AddTo(newPage); // read it newPage->ReadFromFile(); } AppMenuC::GetApp().PostPasteFixup(); fileReadOK = true; } catch (TextC::TextError re) { GenAppErrorMsg("PastePages", re.errMsg); } appConfigFile::Close(); if (!pagesRead.IsEmpty()) { UpdateAppObjects(); // update all pointers for (int i = 0; i < pagesRead.Size(); i++) UpdatePagePointers(pagesRead.GetRef(i)); // set all FO status && update ui for (int i = 0; i < pagesRead.Size(); i++) UpdatePageStatus(pagesRead.GetRef(i)); if (fileReadOK) { GenAppClearMsgs(); FuncObjArray objsToCalc(nObjects); objsToCalc.SetEmpty(); for (int i = 0; i < pagesRead.Size(); i++) GetCalcObjects(pagesRead.GetRef(i), objsToCalc); FuncObjC::CalcSelectedObjects(foc_Full, objsToCalc); PlotDefC::ReplotAfterCalc(); ExposedObjC::UpdateAllExposed(); } } DeallocFuncObjList(); }
PFModule *KinsolNonlinSolverNewPublicXtra() { PFModule *this_module = ThisPFModule; PublicXtra *public_xtra; char *switch_name; char key[IDB_MAX_KEY_LEN]; int switch_value; NameArray switch_na; NameArray verbosity_switch_na; NameArray eta_switch_na; NameArray globalization_switch_na; NameArray precond_switch_na; public_xtra = ctalloc(PublicXtra, 1); sprintf(key, "Solver.Nonlinear.ResidualTol"); (public_xtra->residual_tol) = GetDoubleDefault(key, 1e-7); sprintf(key, "Solver.Nonlinear.StepTol"); (public_xtra->step_tol) = GetDoubleDefault(key, 1e-7); sprintf(key, "Solver.Nonlinear.MaxIter"); (public_xtra->max_iter) = GetIntDefault(key, 15); sprintf(key, "Solver.Linear.KrylovDimension"); (public_xtra->krylov_dimension) = GetIntDefault(key, 10); sprintf(key, "Solver.Linear.MaxRestarts"); (public_xtra->max_restarts) = GetIntDefault(key, 0); verbosity_switch_na = NA_NewNameArray("NoVerbosity LowVerbosity " "NormalVerbosity HighVerbosity"); sprintf(key, "Solver.Nonlinear.PrintFlag"); switch_name = GetStringDefault(key, "LowVerbosity"); (public_xtra->print_flag) = NA_NameToIndex(verbosity_switch_na, switch_name); NA_FreeNameArray(verbosity_switch_na); eta_switch_na = NA_NewNameArray("EtaConstant Walker1 Walker2"); sprintf(key, "Solver.Nonlinear.EtaChoice"); switch_name = GetStringDefault(key, "Walker2"); switch_value = NA_NameToIndex(eta_switch_na, switch_name); switch (switch_value) { case 0: { public_xtra->eta_choice = ETACONSTANT; public_xtra->eta_value = GetDoubleDefault("Solver.Nonlinear.EtaValue", 1e-4); public_xtra->eta_alpha = 0.0; public_xtra->eta_gamma = 0.0; break; } case 1: { public_xtra->eta_choice = ETACHOICE1; public_xtra->eta_alpha = 0.0; public_xtra->eta_gamma = 0.0; break; } case 2: { public_xtra->eta_choice = ETACHOICE2; public_xtra->eta_alpha = GetDoubleDefault("Solver.Nonlinear.EtaAlpha", 2.0); public_xtra->eta_gamma = GetDoubleDefault("Solver.Nonlinear.EtaGamma", 0.9); public_xtra->eta_value = 0.0; break; } default: { InputError("Error: Invalid value <%s> for key <%s>\n", switch_name, key); } } NA_FreeNameArray(eta_switch_na); switch_na = NA_NewNameArray("False True"); sprintf(key, "Solver.Nonlinear.UseJacobian"); switch_name = GetStringDefault(key, "False"); switch_value = NA_NameToIndex(switch_na, switch_name); switch (switch_value) { case 0: { (public_xtra->matvec) = NULL; break; } case 1: { (public_xtra->matvec) = KINSolMatVec; break; } default: { InputError("Error: Invalid value <%s> for key <%s>\n", switch_name, key); } } NA_FreeNameArray(switch_na); sprintf(key, "Solver.Nonlinear.DerivativeEpsilon"); (public_xtra->derivative_epsilon) = GetDoubleDefault(key, 1e-7); globalization_switch_na = NA_NewNameArray("InexactNewton LineSearch"); sprintf(key, "Solver.Nonlinear.Globalization"); switch_name = GetStringDefault(key, "LineSearch"); switch_value = NA_NameToIndex(globalization_switch_na, switch_name); switch (switch_value) { case 0: { (public_xtra->globalization) = INEXACT_NEWTON; break; } case 1: { (public_xtra->globalization) = LINESEARCH; break; } default: { InputError("Error: Invalid value <%s> for key <%s>\n", switch_name, key); } } NA_FreeNameArray(globalization_switch_na); precond_switch_na = NA_NewNameArray("NoPC MGSemi SMG PFMG PFMGOctree"); sprintf(key, "Solver.Linear.Preconditioner"); switch_name = GetStringDefault(key, "MGSemi"); switch_value = NA_NameToIndex(precond_switch_na, switch_name); if (switch_value == 0) { (public_xtra->precond) = NULL; (public_xtra->pcinit) = NULL; (public_xtra->pcsolve) = NULL; } else if (switch_value > 0) { (public_xtra->precond) = PFModuleNewModuleType( KinsolPCNewPublicXtraInvoke, KinsolPC, (key, switch_name)); (public_xtra->pcinit) = (KINSpgmrPrecondFn)KINSolInitPC; (public_xtra->pcsolve) = (KINSpgmrPrecondSolveFn)KINSolCallPC; } else { InputError("Error: Invalid value <%s> for key <%s>\n", switch_name, key); } NA_FreeNameArray(precond_switch_na); public_xtra->nl_function_eval = PFModuleNewModule(NlFunctionEval, ()); public_xtra->neq = ((public_xtra->max_restarts) + 1) * (public_xtra->krylov_dimension); if (public_xtra->matvec != NULL) public_xtra->richards_jacobian_eval = PFModuleNewModuleType( RichardsJacobianEvalNewPublicXtraInvoke, RichardsJacobianEval, ("Solver.Nonlinear.Jacobian")); else public_xtra->richards_jacobian_eval = NULL; (public_xtra->time_index) = RegisterTiming("KINSol"); PFModulePublicXtra(this_module) = public_xtra; return this_module; }
void appCopyPaste::PasteObjects() { bool fileReadOK = false; MenuObjArray objectsRead; try { appConfigFile::OpenAsClipboard(true); // header ReadObjHeader(); int nObjects = ReadInt(); if (nObjects == 0) InputError("No objects ??"); // check that page type is supported char pageStr[160]; ReadText(pageStr, 160); if (!AllocPageC::MenuPageExists(pageStr)) InputError("Page type not supported by application"); // and all object types for (int i = 0; i < nObjects; i++) { char objStr[160]; ReadText(objStr, 160); if (!AllocObjC::MenuObjectExists(objStr)) InputError("Object type not supported by application"); if (!MenuPageC::currPageObj->ObjectOKForPage(objStr)) InputError("Object not supported on current page"); } // read app globals ReadAppGlobals(); AppMenuC::GetApp().PrePasteSetup(); // read objects objectsRead.Alloc(nObjects); for (int i = 0; i < nObjects; i++) { char objStr[160]; ReadText(objStr, 160); MenuObjC* currObj = AllocObjC::CreateMenuObject(objStr, MenuPageC::currPageObj->GetActualParent()); currObj->ReadFromFile(); objectsRead += currObj; MenuPageC::currPageObj->AddObject(currObj); MenuRootC::currTreeObj->AddObjectLeafToRoot(MenuPageC::currPageObj, currObj); } AppMenuC::GetApp().PrePasteSetup(); fileReadOK = true; } catch (TextC::TextError re) { GenAppErrorMsg("PasteObjects", re.errMsg); } appConfigFile::Close(); if (!objectsRead.IsEmpty()) { UpdateAppObjects(); MenuObjC* currObj; // update all pointers int i; for (i = 0; i < objectsRead.Size(); i++) { currObj = objectsRead[i]; // update refs currObj->objFunction->UpdateFuncObjRefs(); currObj->objDeleteable = true; currObj->objSelected = false; } // set all FO status and UI for (i = 0; i < objectsRead.Size(); i++) { currObj = objectsRead[i]; currObj->objFunction->DoStatusChk(); currObj->UpdateTreeData(); } if (fileReadOK) { GenAppClearMsgs(); FuncObjArray objsToCalc(objectsRead.Size()); objsToCalc.SetEmpty(); for (i = 0; i < objectsRead.Size(); i++) objsToCalc += objectsRead[i]->objFunction; FuncObjC::CalcSelectedObjects(foc_Full, objsToCalc); PlotDefC::ReplotAfterCalc(); ExposedObjC::UpdateAllExposed(); objectsRead.LastIndex()->SelectNode(); } } DeallocFuncObjList(); }
SO2Bands::SO2Bands(int nw_in, const double *wl) { const static float wso2[NSO2] = { 280, 281, 281.9, 282.5, 283.1, 283.9, 284.9, 286.1, 287, 288.3, 289, 290.2, 290.5, 290.8, 291.5, 292.2, 293.2, 294, 295.4, 296.3, 297.8, 298.1, 299.2, 300, 300.03, 300.06, 300.09, 300.12, 300.15, 300.18, 300.21, 300.24, 300.27, 300.3, 300.33, 300.36, 300.39, 300.42, 300.45, 300.48, 300.51, 300.54, 300.57, 300.6, 300.63, 300.66, 300.69, 300.72, 300.75, 300.78, 300.81, 300.84, 300.87, 300.9, 300.93, 300.96, 300.99, 301.02, 301.05, 301.08, 301.11, 301.14, 301.17, 301.2, 301.23, 301.26, 301.29, 301.32, 301.35, 301.38, 301.41, 301.44, 301.47, 301.5, 301.53, 301.56, 301.59, 301.62, 301.65, 301.68, 301.71, 301.74, 301.77, 301.8, 301.83, 301.86, 301.89, 301.92, 301.95, 301.98, 302.01, 302.04, 302.07, 302.1, 302.13, 302.16, 302.19, 302.22, 302.25, 302.28, 302.31, 302.34, 302.37, 302.4, 302.43, 302.46, 302.49, 302.52, 302.55, 302.58, 302.61, 302.64, 302.67, 302.7, 302.73, 302.76, 302.79, 302.82, 302.85, 302.88, 302.91, 302.94, 302.97, 303, 303.03, 303.06, 303.09, 303.12, 303.15, 303.18, 303.21, 303.24, 303.27, 303.3, 303.33, 303.36, 303.39, 303.42, 303.45, 303.48, 303.51, 303.54, 303.57, 303.6, 303.63, 303.66, 303.69, 303.72, 303.75, 303.78, 303.81, 303.84, 303.87, 303.9, 303.93, 303.96, 303.99, 304.02, 304.05, 304.08, 304.11, 304.14, 304.17, 304.2, 304.23, 304.26, 304.29, 304.32, 304.35, 304.38, 304.41, 304.44, 304.47, 304.5, 304.53, 304.56, 304.59, 304.62, 304.65, 304.68, 304.71, 304.74, 304.77, 304.8, 304.83, 304.86, 304.89, 304.92, 304.95, 304.98, 305.01, 305.04, 305.07, 305.1, 305.13, 305.16, 305.19, 305.22, 305.25, 305.28, 305.31, 305.34, 305.37, 305.4, 305.43, 305.46, 305.49, 305.52, 305.55, 305.58, 305.61, 305.64, 305.67, 305.7, 305.73, 305.76, 305.79, 305.82, 305.85, 305.88, 305.91, 305.94, 305.97, 306, 306.03, 306.06, 306.09, 306.12, 306.15, 306.18, 306.21, 306.24, 306.27, 306.3, 306.33, 306.36, 306.39, 306.42, 306.45, 306.48, 306.51, 306.54, 306.57, 306.6, 306.63, 306.66, 306.69, 306.72, 306.75, 306.78, 306.81, 306.84, 306.87, 306.9, 306.93, 306.96, 306.99, 307.02, 307.05, 307.08, 307.11, 307.14, 307.17, 307.2, 307.23, 307.26, 307.29, 307.32, 307.35, 307.38, 307.41, 307.44, 307.47, 307.5, 307.53, 307.56, 307.59, 307.62, 307.65, 307.68, 307.71, 307.74, 307.77, 307.8, 307.83, 307.86, 307.89, 307.92, 307.95, 307.98, 308.01, 308.04, 308.07, 308.1, 308.13, 308.16, 308.19, 308.22, 308.25, 308.28, 308.31, 308.34, 308.37, 308.4, 308.43, 308.46, 308.49, 308.52, 308.55, 308.58, 308.61, 308.64, 308.67, 308.7, 308.73, 308.76, 308.79, 308.82, 308.85, 308.88, 308.91, 308.94, 308.97, 309, 309.03, 309.06, 309.09, 309.12, 309.15, 309.18, 309.21, 309.24, 309.27, 309.3, 309.33, 309.36, 309.39, 309.42, 309.45, 309.48, 309.51, 309.54, 309.57, 309.6, 309.63, 309.66, 309.69, 309.72, 309.75, 309.78, 309.81, 309.84, 309.87, 309.9, 309.93, 309.96, 309.99, 310.02, 310.05, 310.08, 310.11, 310.14, 310.17, 310.2, 310.23, 310.26, 310.29, 310.32, 310.35, 310.38, 310.41, 310.44, 310.47, 310.5, 310.53, 310.56, 310.59, 310.62, 310.65, 310.68, 310.71, 310.74, 310.77, 310.8, 310.83, 310.86, 310.89, 310.92, 310.95, 310.98, 311.01, 311.04, 311.07, 311.1, 311.13, 311.16, 311.19, 311.22, 311.25, 311.28, 311.31, 311.34, 311.37, 311.4, 311.43, 311.46, 311.49, 311.52, 311.55, 311.58, 311.61, 311.64, 311.67, 311.7, 311.73, 311.76, 311.79, 311.82, 311.85, 311.88, 311.91, 311.94, 311.97, 312, 312.03, 312.06, 312.09, 312.12, 312.15, 312.18, 312.21, 312.24, 312.27, 312.3, 312.33, 312.36, 312.39, 312.42, 312.45, 312.48, 312.51, 312.54, 312.57, 312.6, 312.63, 312.66, 312.69, 312.72, 312.75, 312.78, 312.81, 312.84, 312.87, 312.9, 312.93, 312.96, 312.99, 313.02, 313.05, 313.08, 313.11, 313.14, 313.17, 313.2, 313.23, 313.26, 313.29, 313.32, 313.35, 313.38, 313.41, 313.44, 313.47, 313.5, 313.53, 313.56, 313.59, 313.62, 313.65, 313.68, 313.71, 313.74, 313.77, 313.8, 313.83, 313.86, 313.89, 313.92, 313.95, 313.98, 314.01, 314.04, 314.07, 314.1, 314.13, 314.16, 314.19, 314.22, 314.25, 314.28, 314.31, 314.34, 314.37, 314.4, 314.43, 314.46, 314.49, 314.52, 314.55, 314.58, 314.61, 314.64, 314.67, 314.7, 314.73, 314.76, 314.79, 314.82, 314.85, 314.88, 314.91, 314.94, 314.97, 315, 315.03, 315.06, 315.09, 315.12, 315.15, 315.18, 315.21, 315.24, 315.27, 315.3, 315.33, 315.36, 315.39, 315.42, 315.45, 315.48, 315.51, 315.54, 315.57, 315.6, 315.63, 315.66, 315.69, 315.72, 315.75, 315.78, 315.81, 315.84, 315.87, 315.9, 315.93, 315.96, 315.99, 316.02, 316.05, 316.08, 316.11, 316.14, 316.17, 316.2, 316.23, 316.26, 316.29, 316.32, 316.35, 316.38, 316.41, 316.44, 316.47, 316.5, 316.53, 316.56, 316.59, 316.62, 316.65, 316.68, 316.71, 316.74, 316.77, 316.8, 316.83, 316.86, 316.89, 316.92, 316.95, 316.98, 317.01, 317.04, 317.07, 317.1, 317.13, 317.16, 317.19, 317.22, 317.25, 317.28, 317.31, 317.34, 317.37, 317.4, 317.43, 317.46, 317.49, 317.52, 317.55, 317.58, 317.61, 317.64, 317.67, 317.7, 317.73, 317.76, 317.79, 317.82, 317.85, 317.88, 317.91, 317.94, 317.97, 318, 318.03, 318.06, 318.09, 318.12, 318.15, 318.18, 318.21, 318.24, 318.27, 318.3, 318.33, 318.36, 318.39, 318.42, 318.45, 318.48, 318.51, 318.54, 318.57, 318.6, 318.63, 318.66, 318.69, 318.72, 318.75, 318.78, 318.81, 318.84, 318.87, 318.9, 318.93, 318.96, 318.99, 319.02, 319.05, 319.08, 319.11, 319.14, 319.17, 319.2, 319.23, 319.26, 319.29, 319.32, 319.35, 319.38, 319.41, 319.44, 319.47, 319.5, 319.53, 319.56, 319.59, 319.62, 319.65, 319.68, 319.71, 319.74, 319.77, 319.8, 319.83, 319.86, 319.89, 319.92, 319.95, 319.98, 320.01, 320.04, 320.07, 320.1, 320.13, 320.16, 320.19, 320.22, 320.25, 320.28, 320.31, 320.34, 320.37, 320.4 }; const static float xso2tpl[NSO2] = { 9.744e-19, 7.714e-19, 1.137e-18, 6.496e-19, 1.015e-18, 7.308e-19, 1.137e-18, 6.902e-19, 1.096e-18, 6.496e-19, 1.137e-18, 9.338e-19, 8.932e-19, 1.096e-18, 6.09e-19, 1.056e-18, 5.684e-19, 1.056e-18, 4.872e-19, 1.096e-18, 3.938e-19, 1.116e-18, 3.248e-19, 1.458e-18, 1.449e-18, 1.352e-18, 1.293e-18, 1.274e-18, 1.095e-18, 1.061e-18, 1.042e-18, 9.794e-19, 9.533e-19, 9.039e-19, 8.546e-19, 8.444e-19, 7.709e-19, 7.653e-19, 7.301e-19, 6.703e-19, 6.352e-19, 6.045e-19, 5.789e-19, 5.55e-19, 5.114e-19, 4.705e-19, 4.562e-19, 4.603e-19, 4.473e-19, 3.968e-19, 3.548e-19, 3.526e-19, 3.446e-19, 3.489e-19, 3.374e-19, 3.338e-19, 2.977e-19, 2.881e-19, 2.868e-19, 3.043e-19, 2.594e-19, 2.52e-19, 2.287e-19, 2.235e-19, 2.106e-19, 2.362e-19, 2.385e-19, 2.075e-19, 1.778e-19, 1.708e-19, 1.978e-19, 1.899e-19, 1.931e-19, 1.842e-19, 1.898e-19, 1.69e-19, 1.885e-19, 2.037e-19, 2.711e-19, 2.854e-19, 3.126e-19, 2.943e-19, 3.641e-19, 4.414e-19, 5.524e-19, 6.181e-19, 7.1e-19, 7.583e-19, 8.579e-19, 9.4e-19, 1.033e-18, 1.014e-18, 1.038e-18, 1.09e-18, 1.123e-18, 1.078e-18, 1.032e-18, 1.019e-18, 9.648e-19, 9.248e-19, 9.11e-19, 9.316e-19, 8.568e-19, 8.183e-19, 7.679e-19, 7.3e-19, 6.639e-19, 6.722e-19, 5.949e-19, 5.323e-19, 5.066e-19, 4.52e-19, 4.728e-19, 4.386e-19, 4.305e-19, 3.98e-19, 3.732e-19, 3.609e-19, 3.485e-19, 3.288e-19, 3.047e-19, 2.854e-19, 2.789e-19, 2.632e-19, 2.373e-19, 2.374e-19, 2.334e-19, 2.199e-19, 2.104e-19, 1.813e-19, 1.793e-19, 1.798e-19, 1.681e-19, 1.778e-19, 1.578e-19, 1.606e-19, 1.594e-19, 1.701e-19, 1.668e-19, 1.909e-19, 1.811e-19, 1.787e-19, 1.789e-19, 1.787e-19, 2.002e-19, 2.004e-19, 1.984e-19, 2.056e-19, 2.196e-19, 2.215e-19, 2.461e-19, 2.352e-19, 2.64e-19, 3.089e-19, 3.675e-19, 4.289e-19, 5.174e-19, 5.418e-19, 6.201e-19, 7.43e-19, 9.542e-19, 1.12e-18, 1.096e-18, 1.007e-18, 9.071e-19, 8.7e-19, 8.569e-19, 8.047e-19, 7.922e-19, 7.688e-19, 6.876e-19, 6.362e-19, 6.718e-19, 6.355e-19, 5.775e-19, 5.716e-19, 5.42e-19, 4.814e-19, 4.234e-19, 4.29e-19, 3.784e-19, 3.329e-19, 3.244e-19, 3.423e-19, 3.283e-19, 2.904e-19, 2.772e-19, 2.757e-19, 2.826e-19, 2.675e-19, 2.384e-19, 2.102e-19, 2.058e-19, 2.083e-19, 2.029e-19, 1.932e-19, 1.713e-19, 1.633e-19, 1.585e-19, 1.525e-19, 1.555e-19, 1.492e-19, 1.33e-19, 1.192e-19, 1.299e-19, 1.292e-19, 1.311e-19, 1.481e-19, 1.453e-19, 1.398e-19, 1.47e-19, 1.567e-19, 1.515e-19, 1.545e-19, 1.617e-19, 1.576e-19, 1.713e-19, 1.908e-19, 2.079e-19, 2.318e-19, 2.526e-19, 2.783e-19, 3.572e-19, 3.672e-19, 3.88e-19, 3.938e-19, 4.158e-19, 4.691e-19, 5.29e-19, 5.42e-19, 5.497e-19, 5.327e-19, 6.065e-19, 6.702e-19, 6.761e-19, 6.91e-19, 7.491e-19, 7.652e-19, 7.794e-19, 7.809e-19, 7.682e-19, 7.191e-19, 6.557e-19, 6.069e-19, 5.96e-19, 5.482e-19, 5.198e-19, 4.61e-19, 4.286e-19, 4.287e-19, 4.067e-19, 3.578e-19, 3.414e-19, 3.291e-19, 3.126e-19, 3.028e-19, 3.022e-19, 2.865e-19, 2.688e-19, 2.658e-19, 2.743e-19, 2.555e-19, 2.591e-19, 2.346e-19, 2.308e-19, 2.028e-19, 1.932e-19, 1.81e-19, 1.77e-19, 1.842e-19, 1.664e-19, 1.72e-19, 1.652e-19, 1.655e-19, 1.686e-19, 1.696e-19, 1.941e-19, 1.729e-19, 1.885e-19, 1.912e-19, 1.754e-19, 1.822e-19, 1.793e-19, 2.015e-19, 1.846e-19, 1.818e-19, 1.647e-19, 1.654e-19, 1.746e-19, 1.852e-19, 1.913e-19, 1.911e-19, 1.985e-19, 2.187e-19, 2.432e-19, 2.793e-19, 2.843e-19, 2.669e-19, 2.661e-19, 2.456e-19, 2.744e-19, 2.75e-19, 3.477e-19, 4.052e-19, 4.23e-19, 4.685e-19, 5.388e-19, 5.477e-19, 6.264e-19, 6.552e-19, 6.611e-19, 6.292e-19, 5.853e-19, 5.26e-19, 5.168e-19, 4.613e-19, 4.562e-19, 4.397e-19, 4.352e-19, 3.723e-19, 3.511e-19, 3.293e-19, 3.018e-19, 2.908e-19, 2.772e-19, 2.518e-19, 2.369e-19, 2.291e-19, 2.308e-19, 2.107e-19, 2.041e-19, 1.905e-19, 1.878e-19, 1.852e-19, 1.779e-19, 1.685e-19, 1.612e-19, 1.359e-19, 1.326e-19, 1.404e-19, 1.379e-19, 1.487e-19, 1.486e-19, 1.423e-19, 1.537e-19, 1.56e-19, 1.581e-19, 1.594e-19, 1.62e-19, 1.502e-19, 1.517e-19, 1.504e-19, 1.549e-19, 1.375e-19, 1.444e-19, 1.538e-19, 1.492e-19, 1.476e-19, 1.758e-19, 1.754e-19, 1.876e-19, 1.745e-19, 1.755e-19, 1.796e-19, 1.792e-19, 1.849e-19, 1.857e-19, 1.846e-19, 1.84e-19, 1.906e-19, 1.964e-19, 2.434e-19, 2.803e-19, 3.22e-19, 3.313e-19, 3.651e-19, 3.88e-19, 4.281e-19, 4.248e-19, 4.158e-19, 3.897e-19, 3.472e-19, 3.378e-19, 3.261e-19, 2.987e-19, 2.757e-19, 2.644e-19, 2.553e-19, 2.713e-19, 2.82e-19, 2.575e-19, 2.511e-19, 2.584e-19, 2.367e-19, 2.161e-19, 2.15e-19, 2.15e-19, 2.155e-19, 2.063e-19, 1.884e-19, 1.746e-19, 1.626e-19, 1.611e-19, 1.561e-19, 1.317e-19, 1.244e-19, 1.222e-19, 1.22e-19, 1.102e-19, 9.686e-20, 9.89e-20, 1.048e-19, 1.025e-19, 9.563e-20, 9.875e-20, 9.61e-20, 9.905e-20, 1.066e-19, 1.106e-19, 1.206e-19, 1.275e-19, 1.279e-19, 1.393e-19, 1.331e-19, 1.337e-19, 1.42e-19, 1.398e-19, 1.25e-19, 1.214e-19, 1.216e-19, 1.211e-19, 1.152e-19, 1.193e-19, 1.238e-19, 1.22e-19, 1.233e-19, 1.211e-19, 1.317e-19, 1.376e-19, 1.431e-19, 1.435e-19, 1.47e-19, 1.526e-19, 1.498e-19, 1.432e-19, 1.39e-19, 1.332e-19, 1.363e-19, 1.508e-19, 1.647e-19, 1.868e-19, 1.982e-19, 2.044e-19, 2.296e-19, 2.532e-19, 2.811e-19, 2.942e-19, 3.056e-19, 3e-19, 2.854e-19, 2.703e-19, 2.559e-19, 2.502e-19, 2.338e-19, 2.266e-19, 2.187e-19, 2.086e-19, 1.958e-19, 1.807e-19, 1.652e-19, 1.548e-19, 1.426e-19, 1.339e-19, 1.27e-19, 1.201e-19, 1.165e-19, 1.103e-19, 1.064e-19, 1.056e-19, 1.011e-19, 9.842e-20, 1.222e-19, 1.386e-19, 1.241e-19, 1.191e-19, 1.107e-19, 1.057e-19, 9.674e-20, 9.306e-20, 8.353e-20, 8.314e-20, 7.906e-20, 7.599e-20, 8.161e-20, 7.207e-20, 6.425e-20, 6.574e-20, 7.085e-20, 6.545e-20, 6.826e-20, 7.997e-20, 8.297e-20, 7.719e-20, 7.352e-20, 8.277e-20, 1.023e-19, 1.07e-19, 1.057e-19, 1.093e-19, 1.08e-19, 1.054e-19, 1.058e-19, 1.044e-19, 1.14e-19, 1.202e-19, 1.162e-19, 1.194e-19, 1.191e-19, 1.018e-19, 9.313e-20, 9.804e-20, 9.138e-20, 9.043e-20, 9.508e-20, 9.708e-20, 9.832e-20, 1.045e-19, 1.158e-19, 1.41e-19, 1.558e-19, 1.53e-19, 1.536e-19, 1.518e-19, 1.426e-19, 1.413e-19, 1.316e-19, 1.283e-19, 1.263e-19, 1.114e-19, 1.06e-19, 1.135e-19, 1.321e-19, 1.208e-19, 1.195e-19, 1.211e-19, 1.457e-19, 1.516e-19, 1.533e-19, 1.518e-19, 1.399e-19, 1.304e-19, 1.126e-19, 1.028e-19, 1.083e-19, 9.96e-20, 9.418e-20, 8.286e-20, 8.049e-20, 8.219e-20, 7.231e-20, 6.265e-20, 6.607e-20, 6.718e-20, 6.381e-20, 6.012e-20, 6.105e-20, 5.813e-20, 5.854e-20, 6.199e-20, 5.408e-20, 5.615e-20, 6.364e-20, 5.939e-20, 6.273e-20, 6.861e-20, 7.715e-20, 8.488e-20, 9.438e-20, 9.284e-20, 8.905e-20, 8.386e-20, 8.536e-20, 9.176e-20, 9.322e-20, 8.907e-20, 8.161e-20, 8.337e-20, 9.234e-20, 8.779e-20, 8.792e-20, 8.532e-20, 8.274e-20, 8.855e-20, 9.435e-20, 9.637e-20, 1e-19, 1.087e-19, 1.066e-19, 1.04e-19, 9.61e-20, 9.075e-20, 8.583e-20, 7.762e-20, 7.748e-20, 7.17e-20, 7.259e-20, 6.86e-20, 6.743e-20, 6.486e-20, 6.145e-20, 6.533e-20, 7.024e-20, 7.039e-20, 7.014e-20, 6.979e-20, 6.606e-20, 6.728e-20, 6.761e-20, 7.415e-20, 7.468e-20, 7.456e-20, 7.851e-20, 8.124e-20, 9.392e-20, 1.115e-19, 1.171e-19, 1.118e-19, 1.048e-19, 9.506e-20, 9.72e-20, 8.582e-20, 7.631e-20, 8.253e-20, 7.262e-20, 7.373e-20, 7.645e-20, 7.342e-20, 6.153e-20, 6.094e-20, 6.18e-20, 5.933e-20, 5.025e-20, 4.567e-20, 4.381e-20, 4.209e-20, 3.942e-20, 3.871e-20, 3.328e-20, 3.158e-20, 2.936e-20, 3.242e-20, 2.941e-20, 2.903e-20, 2.743e-20, 2.84e-20, 3.129e-20, 3.039e-20, 3.098e-20, 2.791e-20, 3.234e-20, 3.246e-20, 3.368e-20, 3.365e-20, 3.243e-20, 3.23e-20, 3.195e-20, 3.437e-20, 3.723e-20, 4.169e-20, 4.617e-20, 4.482e-20, 5.742e-20, 5.677e-20, 5.761e-20, 6.062e-20, 6.868e-20, 6.984e-20, 6.796e-20, 6.442e-20, 5.72e-20, 5.497e-20, 5.883e-20, 6.61e-20, 6.322e-20, 7.501e-20, 6.537e-20, 5.746e-20, 5.044e-20, 4.889e-20, 4.719e-20, 4.62e-20, 4.637e-20, 4.503e-20, 3.86e-20, 4.036e-20, 3.601e-20, 3.343e-20, 3.329e-20, 2.985e-20, 2.973e-20, 2.787e-20, 2.718e-20, 2.767e-20, 2.498e-20 }; nw = nw_in; if (!(xsso2 = new double[nw])) { InputError(ERROR, "Unable to allocate memory in \"SO2Bands\"."); exit (3); } Rebin(NSO2, wso2, xso2tpl, nw, wl, xsso2); }
int ReadCDFFile(char *name, InputSection section) { int cdfid, i, j, *dimdim, dimfound, ndim, nvar, natt, recdim, *dim, nvarfound, bigdim = 0, coordfound = 0, mem, pointvalues; static int ncoord = 0; FILE *f; BOOL timedvar, noclose = FALSE; VarDesc *v, vh, *vo; Coordinate *coord = NULL; size_t start[1], count[1]; ptrdiff_t stride[1], imap[1]; const struct { char name[5]; Dimension dim; int *size; } dimtab[] = {"X", X_DIM, &nxm, "Y", Y_DIM, &nym, "Z", Z_DIM, &nz, "Time", TIME_DIM, NULL, "CNT", COUNT_DIM, &ncoord}; char txt[MAX_NC_NAME]; BorderTimeDesc *bt; size_t *coords, len, *dimptr[5], lcoord[5], ntimes; long *timetable = NULL; double *doubtable; nc_type datatype; if (section == GRID || section == TIME || section == DEPOSITION) { InputError(ERROR, "CDFIMPORT is not allowed in this section."); return (1); } if (!(f = fopen(name, "r"))) { InputError(ERROR, "Unable to open CDF-File \"%s\".", name); return (1); } fclose(f); if (nc_open(name, NC_NOWRITE, &cdfid)) { InputError(ERROR, "Unable to open CDF-File %s.", name); return (1); } nc_inq(cdfid, &ndim, &nvar, &natt, &recdim); dim = (int *)calloc(ndim, sizeof(int)); dimdim = (int *)calloc(ndim, sizeof(int)); nvarfound = dimfound = 0; for (i = ndim; i--; ) { nc_inq_dim(cdfid, i, txt, &len); for (j = 5; --j >= 0 && strcmp(txt, dimtab[j].name); ); dimdim[i] = j; if (j >= 0 && dimtab[j].size) { if (j < 2) { if (len != *dimtab[j].size && len != *dimtab[j].size+2) { InputError(WARNING, "\"%s\": Dimension %s has wrong size. Is %i should be %i or %i.", name, txt, len, *dimtab[j].size, *dimtab[j].size+2); dimdim[i] = -1; } else { dimfound |= 1 << j; if (len == *dimtab[j].size+2) bigdim |= 1 << j; } } else if (j < 4) { if (len != *dimtab[j].size) { InputError(WARNING, "\"%s\": Dimension %s has wrong size. Is %i should be %i.", name, txt, len, *dimtab[j].size); dimdim[i] = -1; } else dimfound |= 1 << j; } else { *dimtab[j].size = len; dimfound |= 1 << j; } } if (j == 3) ntimes = len; } if (bigdim && bigdim != ((X_DIM | Y_DIM) & dimfound)) { InputError(ERROR, "Mismatch of X/Y-Dimension-sizes."); goto error_end; } bigdim = !!bigdim; for (i = nvar; i--; ) { nc_inq_var(cdfid, i, txt, &datatype, &ndim, dim, &natt); for (v = variable; v && strcmp(txt, v->name); v = v->next); if (v) { vo = v; if (v->storetype == GRID_VAL && actualsection->id >= NORTH_BORDER && actualsection->id <= EAST_BORDER) v = BorderVariable(v, &vh); if (v->storetype == GRID_VAL && actualsection->id == EMISSIONS) { pointvalues = (ndim < 3 && (dimdim[*dim] == 4 || dimdim[dim[1]] == 4) ? *dimtab[4].size : 0); if (pointvalues && !coord) coord = AllocateCoordVar(pointvalues); v = EmissionVariable(v, pointvalues, 0, coord); } if (v->section == section) { if (v->inputtype != NORMAL_NUM) { InputError(WARNING, "The Variable %s cannot be set via a CDF-File.\n", inplineno, txt); continue; } if (datatype != NC_DOUBLE && datatype != NC_FLOAT && datatype != NC_LONG) { InputError(ERROR, "\"%s\": The type of variable %s is not of appropriate type.", name, txt); goto error_end; } if (v->init == WAS_SET_BY_USER) { InputError(WARNING, "The variable \"%s\" found in file \"%s\" is already initialized.", txt, name); if (section == EMISSIONS) InputError(WARNING, " ....so summing up emissions.\n"); else continue; } if (v->init == CALCULATED_VALUES) { InputError(WARNING, "The variable \"%s\" found in file \"%s\" cannot be initialized.\n" " It's calculated by meteochem.", txt, name); continue; } if ((v->option & STARTING_WITH_ZERO) && !bigdim) { InputError(ERROR, "Variable \"%s\" requires Dimensions X and Y to be two fields bigger", v->name); goto error_end; } memset(dimptr, 0, 5 * sizeof(*dimptr)); for (j = ndim; --j >= 0 && dimdim[dim[j]] != 3; ); if (timedvar = j >= 0) { if (actualsection->id < ENVIRONMENT || actualsection->id == INITIAL_DATA) { InputError(ERROR, "Time-dependent variables are not allowed in this section."); goto error_end; } noclose = TRUE; bt = (BorderTimeDesc *)malloc(sizeof(BorderTimeDesc)); if (v->dims == (X_DIM | Z_DIM)) bt->vartype = XWALL_VAR; else if (v->dims == (Y_DIM | Z_DIM)) bt->vartype = WALL_VAR; else if (v->dims == (X_DIM | Y_DIM)) bt->vartype = (v->storetype == GROUND_PARAM ? GROUND_VAR : LAYER_VAR); else if (v->dims == Z_DIM) bt->vartype = PROFILE_VAR; else if (v->dims == ALL_DIM) bt->vartype = MESH_VAR; else if (v->dims == COUNT_DIM) bt->vartype = COORD_VAR; else { InputError(ERROR, "The variable \"%s\" must not be time-dependent.", v->name); goto error_end; } bt->section = InputSection(actualsection->id); bt->bigdim = bigdim; bt->ntime = ntimes; bt->itime = -1; bt->actime = 0; bt->cdfid = cdfid; bt->vid = i; bt->actualvar = *v; bt->nextvar = *v; bt->timetable = timetable; coords = bt->coords; bt->actualdata.d = v->v.d; switch (bt->vartype) { case XWALL_VAR : mem = xrow*nz; break; case WALL_VAR : mem = row*nz; break; case GROUND_VAR : bt->nextvar.storetype = DOUBLE_PTR; case LAYER_VAR : mem = layer; break; case PROFILE_VAR : mem = nz; break; case MESH_VAR : mem = mesh; break; case COORD_VAR : mem = v->ncoord; break; } bt->nextdata = (double *)calloc(mem, sizeof(double)); if (!(bt->nextvar.v.d = bt->nextdata)) { InputError(ERROR, "Unable to allocate memory in Function \"ReadCDFFile\""); goto error_end; } bt->next = bordertime; bordertime = bt; } else coords = lcoord; for (j = ndim; j--; ) { if (dimdim[dim[j]] < 0) { nc_inq_dim(cdfid, dim[j], txt, &len); InputError(ERROR, "\"%s\": Variable %s includes \"%s\", an unkown or unusable dimension.", name, v->name, txt); goto error_end; } dimptr[dimdim[dim[j]]] = coords + j; } for (j = 5; j--; ) if (!dimptr[j]) dimptr[j] = coords + ndim++; printf("Reading Variable %s from CDF-File \"%s\"\n", txt, name); *dimptr[3] = 0; nvarfound++; vo->init = WAS_SET_BY_USER; if (ReadVarFromCDF(cdfid, i, v, dimptr, coords, !!bigdim)) goto error_end; if (timedvar) memcpy(bt->dimptr, dimptr, 5 * sizeof(long *)); } else if (!strcmp(txt, "Time")) { timetable = (long *)calloc(ntimes, sizeof(long)); *lcoord = 0; if (nc_get_vara_long(cdfid, i, lcoord, &ntimes, timetable)) { InputError(ERROR, "A variable called \"Time\" was found, but I couldn't read it."); } else { if (*timetable > tstart) InputError(WARNING, "The first time-slice for value for %s is later (%ld sec) than tstart(%ld sec).", v->name, *timetable, tstart); for (bt = bordertime; bt; bt = bt->next) if (!bt->timetable) bt->timetable = timetable; } } } else if (!strcmp(txt, "XCoord") || !strcmp(txt, "YCoord") || !strcmp(txt, "ZCoord")) { if (ndim == 1 && dimdim[*dim] == 4) { if (!coord) coord = AllocateCoordVar(*dimtab[4].size); *start = 0; *count = *dimtab[4].size; *stride = 1; *imap = &coord[1].x - &coord[0].x; nc_get_varm_float(cdfid, i, start, count, stride, imap, &coord[0].x + (*txt - 'X')); coordfound |= 1 << (*txt - 'X'); } } } if (coord) if (coordfound != 7) { InputError(ERROR, "Not all necessary coordinates found in file \"%s\".", name); goto error_end; } else ConvertEmissionCoords(*dimtab[4].size, coord, 0); if (!noclose) nc_close(cdfid); free(dim); if (!nvarfound) InputError(WARNING, "No usable Variable found in File \"%s\".", name); return (0); error_end : nc_close(cdfid); free(dim); free(dimdim); return (1); }
int ReadVarFromCDF(int cdfid, int vid, VarDesc *v, size_t **d, size_t *coords, BOOL bigdim) { int lnx, lny, offs, startloop; int startoff = ((v->option & STARTING_WITH_ZERO) != 0); double tmp; nc_type vartype; nc_inq_vartype(cdfid, vid, &vartype); lnx = nxm + bigdim + startoff; lny = nym + bigdim + startoff; offs = !startoff && !bigdim; startloop = !startoff && bigdim; switch (v->storetype) { case GRID_VAL : if (!g[v->v.et]) g[v->v.et] = (double *)calloc(mesh, sizeof(double)); for (*d[2] = 0; *d[2] < nz; (*d[2])++) for (*d[0] = startloop; *d[0] < lnx; (*d[0])++) for (*d[1] = startloop; *d[1] < lny; (*d[1])++) NCGET(g[v->v.et][F(*d[2],*d[0]+offs,*d[1]+offs)]); break; case DOUBLE_PTR : switch (v->dims) { case (ALL_DIM) : for (*d[2] = 0; *d[2] < nz; (*d[2])++) for (*d[0] = startloop; *d[0] < lnx; (*d[0])++) for (*d[1] = startloop; *d[1] < lny; (*d[1])++) NCGET(v->v.d[F(*d[2],*d[0]+offs,*d[1]+offs)]); break; case (X_DIM | Y_DIM) : for (*d[0] = startloop; *d[0] < lnx; (*d[0])++) for (*d[1] = 0; *d[1] < lny; (*d[1])++) NCGET(v->v.d[FH(*d[0]+offs,*d[1]+offs)]); break; case (Y_DIM | Z_DIM) : for (*d[2] = 0; *d[2] < nz; (*d[2])++) for (*d[1] = startloop; *d[1] < lny; (*d[1])++) NCGET(v->v.d[FH(*d[2],*d[1]+offs)]); break; case (X_DIM | Z_DIM) : for (*d[2] = 0; *d[2] < nz; (*d[2])++) for (*d[0] = startloop; *d[0] < lnx; (*d[0])++) NCGET(v->v.d[*d[2] * xrow + *d[0]+offs]); break; case X_DIM : for (*d[0] = startloop; *d[0] < lnx; (*d[0])++) NCGET(v->v.d[*d[0]+offs]); break; case Y_DIM : for (*d[1] = startloop; *d[1] < lny; (*d[1])++) NCGET(v->v.d[*d[1]+offs]); break; case Z_DIM : for (*d[2] = 0; *d[2] < nz; (*d[2])++) NCGET(v->v.d[*d[2]]); break; case COUNT_DIM : for (*d[4] = 0; *d[4] < v->ncoord; (*d[4])++) NCGET(v->v.d[*d[4]]); break; case 0 : NCGET(*v->v.d); break; default : InputError(ERROR, "Internal implementation error (2)"); break; } break; case GROUND_PARAM : for (*d[0] = startloop; *d[0] < lnx; (*d[0])++) for (*d[1] = startloop; *d[1] < lny; (*d[1])++) NCGET(v->v.g[(*d[0]+offs)*row+*d[1]+offs].Tg[0]); break; default : InputError(ERROR, "Variable %s cannot be set via CDF-File. (Wrong-Type)", v->name); return (1); } return (0); }
NO2Bands::NO2Bands(int nw_in, const double *wl) { const static float wno2[NNO2] = { 263.8, 264.3, 264.8, 265.3, 265.8, 266.4, 266.9, 267.4, 267.9, 268.4, 268.9, 269.4, 270, 270.5, 271, 271.5, 272, 272.5, 273, 273.6, 274.1, 274.6, 275.1, 275.6, 276.1, 276.6, 277.2, 277.7, 278.2, 278.7, 279.2, 279.7, 280.2, 280.8, 281.3, 281.8, 282.3, 282.8, 283.3, 283.8, 284.4, 284.9, 285.4, 285.9, 286.4, 286.9, 287.4, 287.9, 288.5, 289, 289.5, 290, 290.5, 291, 291.5, 292.1, 292.6, 293.1, 293.6, 294.1, 294.6, 295.1, 295.7, 296.2, 296.7, 297.2, 297.7, 298.2, 298.7, 299.3, 299.8, 300.3, 300.8, 301.3, 301.8, 302.3, 302.9, 303.4, 303.9, 304.4, 304.9, 305.4, 305.9, 306.5, 307, 307.5, 308, 308.5, 309, 309.5, 310.1, 310.6, 311.1, 311.6, 312.1, 312.6, 313.1, 313.6, 314.2, 314.7, 315.2, 315.7, 316.2, 316.7, 317.2, 317.8, 318.3, 318.8, 319.3, 319.8, 320.3, 320.8, 321.4, 321.9, 322.4, 322.9, 323.4, 323.9, 324.4, 325, 325.5, 326, 326.5, 327, 327.5, 328, 328.6, 329.1, 329.6, 330.1, 330.6, 331.1, 331.6, 332.2, 332.7, 333.2, 333.7, 334.2, 334.7, 335.2, 335.7, 336.3, 336.8, 337.3, 337.8, 338.3, 338.8, 339.3, 339.9, 340.4, 340.9, 341.4, 341.9, 342.4, 342.9, 343.5, 344, 344.5, 345, 345.5, 346, 346.5, 347.1, 347.6, 348.1, 348.6, 349.1, 349.6, 350.1, 350.7, 351.2, 351.7, 352.2, 352.7, 353.2, 353.7, 354.3, 354.8, 355.3, 355.8, 356.3, 356.8, 357.3, 357.8, 358.4, 358.9, 359.4, 359.9, 360.4, 360.9, 361.4, 362, 362.5, 363, 363.5, 364, 364.5, 365, 365.6, 366.1, 366.6, 367.1, 367.6, 368.1, 368.6, 369.2, 369.7, 370.2, 370.7, 371.2, 371.7, 372.2, 372.8, 373.3, 373.8, 374.3, 374.8, 375.3, 375.8, 376.4, 376.9, 377.4, 377.9, 378.4, 378.9, 379.4, 379.9, 380.5, 381, 381.5, 382, 382.5, 383, 383.5, 384.1, 384.6, 385.1, 385.6, 386.1, 386.6, 387.1, 387.7, 388.2, 388.7, 389.2, 389.7, 390.2, 390.7, 391.3, 391.8, 392.3, 392.8, 393.3, 393.8, 394.3, 394.9, 395.4, 395.9, 396.4, 396.9, 397.4, 397.9, 398.5, 399, 399.5, 400, 400.5, 401, 401.5, 402.1, 402.6, 403.1, 403.6, 404.1, 404.6, 405.1, 405.6, 406.2, 406.7, 407.2, 407.7, 408.2, 408.7, 409.2, 409.8, 410.3, 410.8, 411.3, 411.8, 412.3, 412.8, 413.4, 413.9, 414.4, 414.9, 415.4, 415.9, 416.4, 417, 417.5, 418, 418.5, 419, 419.5, 420, 420.6, 421.1, 421.6, 422.1, 422.6, 423.1, 423.6, 424.2, 424.7, 425.2, 425.7, 426.2, 426.7, 427.2, 427.7, 428.3, 428.8, 429.3, 429.8, 430.3, 430.8, 431.3, 431.9, 432.4, 432.9, 433.4, 433.9, 434.4, 434.9, 435.5, 436, 436.5, 437, 437.5, 438, 438.5, 439.1, 439.6, 440.1, 440.6, 441.1, 441.6, 442.1, 442.7, 443.2, 443.7, 444.2, 444.7, 445.2, 445.7, 446.3, 446.8, 447.3, 447.8, 448.3, 448.8, 449.3, 449.8, 450.4, 450.9, 451.4, 451.9, 452.4, 452.9, 453.4, 454, 454.5, 455, 455.5, 456, 456.5, 457, 457.6, 458.1, 458.6, 459.1, 459.6, 460.1, 460.6, 461.2, 461.7, 462.2, 462.7, 463.2, 463.7, 464.2, 464.8, 465.3, 465.8, 466.3, 466.8, 467.3, 467.8, 468.4, 468.9, 469.4, 469.9, 470.4, 470.9, 471.4, 472, 472.5, 473, 473.5, 474, 474.5, 475, 475.5, 476.1, 476.6, 477.1, 477.6, 478.1, 478.6, 479.1, 479.7, 480.2, 480.7, 481.2, 481.7, 482.2, 482.7, 483.3, 483.8, 484.3, 484.8, 485.3, 485.8, 486.3, 486.9, 487.4, 487.9, 488.4, 488.9, 489.4, 489.9, 490.5, 491, 491.5, 492, 492.5, 493, 493.5, 494.1, 494.6, 495.1, 495.6, 496.1, 496.6, 497.1, 497.6, 498.2, 498.7, 499.2, 499.7, 500.2, 500.7, 501.2, 501.8, 502.3, 502.8, 503.3, 503.8, 504.3, 504.8, 505.4, 505.9, 506.4, 506.9, 507.4, 507.9, 508.4, 509, 509.5, 510, 510.5, 511, 511.5, 512, 512.6, 513.1, 513.6, 514.1, 514.6, 515.1, 515.6, 516.2, 516.7, 517.2, 517.7, 518.2, 518.7, 519.2, 519.7, 520.3, 520.8, 521.3, 521.8, 522.3, 522.8, 523.3, 523.9, 524.4, 524.9, 525.4, 525.9, 526.4, 526.9, 527.5, 528, 528.5, 529, 529.5, 530, 530.5, 531.1, 531.6, 532.1, 532.6, 533.1, 533.6, 534.1, 534.7, 535.2, 535.7, 536.2, 536.7, 537.2, 537.7, 538.3, 538.8, 539.3, 539.8, 540.3, 540.8, 541.3, 541.8, 542.4, 542.9, 543.4, 543.9, 544.4, 544.9, 545.4, 546, 546.5, 547, 547.5, 548, 548.5, 549, 549.6, 550.1, 550.6, 551.1, 551.6, 552.1, 552.6, 553.2, 553.7, 554.2, 554.7, 555.2, 555.7, 556.2, 556.8, 557.3, 557.8, 558.3, 558.8, 559.3, 559.8, 560.4, 560.9, 561.4, 561.9, 562.4, 562.9, 563.4, 564, 564.5, 565, 565.5, 566, 566.5, 567, 567.5, 568.1, 568.6, 569.1, 569.6, 570.1, 570.6, 571.1, 571.7, 572.2, 572.7, 573.2, 573.7, 574.2, 574.7, 575.3, 575.8, 576.3, 576.8, 577.3, 577.8, 578.3, 578.9, 579.4, 579.9, 580.4, 580.9, 581.4, 581.9, 582.5, 583, 583.5, 584, 584.5, 585, 585.5, 586.1, 586.6, 587.1, 587.6, 588.1, 588.6, 589.1, 589.6, 590.2, 590.7, 591.2, 591.7, 592.2, 592.7, 593.2, 593.8, 594.3, 594.8, 595.3, 595.8, 596.3, 596.8, 597.4, 597.9, 598.4, 598.9, 599.4, 599.9, 600.4, 601, 601.5, 602, 602.5, 603, 603.5, 604, 604.6, 605.1, 605.6, 606.1, 606.6, 607.1, 607.6, 608.2, 608.7, 609.2, 609.7, 610.2, 610.7, 611.2, 611.7, 612.3, 612.8, 613.3, 613.8, 614.3, 614.8, 615.3, 615.9, 616.4, 616.9, 617.4, 617.9, 618.4, 618.9, 619.5, 620, 620.5, 621, 621.5, 622, 622.5, 623.1, 623.6, 624.1, 624.6, 625.1, 625.6, 626.1, 626.7, 627.2, 627.7, 628.2, 628.7, 629.2, 629.7, 630.3, 630.8, 631.3, 631.8, 632.3, 632.8, 633.3, 633.8, 634.4, 634.9, 635.4, 635.9, 636.4, 636.9, 637.4, 638, 638.5, 639, 639.5, 640, 640.5, 641, 641.6, 642.1, 642.6, 643.1, 643.6, 644.1, 644.6, 645.2, 645.7, 646.2, 646.7, 647.2, 647.7, 648.2, 648.8 }; const static float xno2tpl[NNO2] = { 2.9879e-20, 3.6112e-20, 3.1282e-20, 3.4748e-20, 3.2334e-20, 3.6357e-20, 3.3573e-20, 3.6251e-20, 3.5308e-20, 3.9617e-20, 3.7035e-20, 3.9366e-20, 3.787e-20, 4.0417e-20, 3.7852e-20, 4.1372e-20, 4.0888e-20, 4.3955e-20, 4.2323e-20, 4.5895e-20, 4.4887e-20, 4.7282e-20, 4.5673e-20, 4.7806e-20, 4.7814e-20, 5.0539e-20, 4.884e-20, 5.1552e-20, 5.202e-20, 5.575e-20, 5.4938e-20, 5.7467e-20, 5.7495e-20, 6.0136e-20, 5.8692e-20, 6.0711e-20, 6.0549e-20, 6.4322e-20, 6.5284e-20, 6.801e-20, 6.905e-20, 7.337e-20, 7.3287e-20, 7.5047e-20, 7.4231e-20, 7.6678e-20, 7.6462e-20, 7.8971e-20, 8.037e-20, 8.4381e-20, 8.5226e-20, 8.8255e-20, 9.0267e-20, 9.4446e-20, 9.5266e-20, 9.7099e-20, 9.648e-20, 9.8676e-20, 9.8944e-20, 1.018e-19, 1.0281e-19, 1.0659e-19, 1.0935e-19, 1.1566e-19, 1.1941e-19, 1.2293e-19, 1.221e-19, 1.2273e-19, 1.2313e-19, 1.2565e-19, 1.2509e-19, 1.274e-19, 1.2981e-19, 1.3628e-19, 1.3993e-19, 1.4497e-19, 1.475e-19, 1.5076e-19, 1.5151e-19, 1.5408e-19, 1.5482e-19, 1.5793e-19, 1.5923e-19, 1.6308e-19, 1.6436e-19, 1.6781e-19, 1.7074e-19, 1.7671e-19, 1.7985e-19, 1.8308e-19, 1.8402e-19, 1.8872e-19, 1.9214e-19, 1.9746e-19, 1.979e-19, 1.9903e-19, 1.997e-19, 2.0505e-19, 2.0806e-19, 2.1272e-19, 2.1358e-19, 2.1685e-19, 2.2074e-19, 2.2782e-19, 2.3222e-19, 2.356e-19, 2.3487e-19, 2.3897e-19, 2.4242e-19, 2.4774e-19, 2.4776e-19, 2.4961e-19, 2.5349e-19, 2.6024e-19, 2.6141e-19, 2.6472e-19, 2.6544e-19, 2.7158e-19, 2.7594e-19, 2.8162e-19, 2.8374e-19, 2.877e-19, 2.8817e-19, 2.934e-19, 2.9318e-19, 2.9879e-19, 3.0148e-19, 3.069e-19, 3.0669e-19, 3.0989e-19, 3.1025e-19, 3.1765e-19, 3.2591e-19, 3.3772e-19, 3.3677e-19, 3.3397e-19, 3.3069e-19, 3.3716e-19, 3.3865e-19, 3.4401e-19, 3.4489e-19, 3.4836e-19, 3.4571e-19, 3.5421e-19, 3.6556e-19, 3.7737e-19, 3.7573e-19, 3.7872e-19, 3.8158e-19, 3.9123e-19, 3.8859e-19, 3.8315e-19, 3.7421e-19, 3.7724e-19, 3.7937e-19, 3.8715e-19, 3.9149e-19, 4.0012e-19, 4.0449e-19, 4.1544e-19, 4.1869e-19, 4.2528e-19, 4.2958e-19, 4.4349e-19, 4.3936e-19, 4.296e-19, 4.1876e-19, 4.2345e-19, 4.2755e-19, 4.3538e-19, 4.3145e-19, 4.3088e-19, 4.2674e-19, 4.3821e-19, 4.5492e-19, 4.7348e-19, 4.733e-19, 4.6828e-19, 4.6272e-19, 4.7504e-19, 4.8602e-19, 4.9384e-19, 4.8518e-19, 4.771e-19, 4.6583e-19, 4.6793e-19, 4.7002e-19, 4.8276e-19, 4.8831e-19, 4.9524e-19, 4.9125e-19, 4.9552e-19, 4.9247e-19, 4.9816e-19, 5.016e-19, 5.1782e-19, 5.2787e-19, 5.3095e-19, 5.1667e-19, 5.1495e-19, 5.155e-19, 5.2385e-19, 5.2001e-19, 5.2089e-19, 5.193e-19, 5.2238e-19, 5.1669e-19, 5.2244e-19, 5.314e-19, 5.4784e-19, 5.506e-19, 5.4868e-19, 5.3739e-19, 5.3612e-19, 5.3137e-19, 5.4123e-19, 5.5364e-19, 5.7267e-19, 5.6971e-19, 5.5907e-19, 5.4126e-19, 5.3901e-19, 5.384e-19, 5.5433e-19, 5.6832e-19, 5.8149e-19, 5.7572e-19, 5.7418e-19, 5.652e-19, 5.6203e-19, 5.5495e-19, 5.6006e-19, 5.662e-19, 5.7869e-19, 5.7929e-19, 5.8088e-19, 5.7311e-19, 5.7171e-19, 5.6959e-19, 5.7898e-19, 5.8123e-19, 5.8582e-19, 5.8644e-19, 5.9286e-19, 5.8974e-19, 5.9309e-19, 5.9088e-19, 6.0029e-19, 6.0085e-19, 5.9563e-19, 5.7944e-19, 5.7247e-19, 5.665e-19, 5.7376e-19, 5.83e-19, 5.9609e-19, 5.9279e-19, 5.8573e-19, 5.7864e-19, 5.9224e-19, 6.069e-19, 6.094e-19, 5.9954e-19, 6.0993e-19, 6.1986e-19, 6.2417e-19, 6.1352e-19, 6.0047e-19, 5.8004e-19, 5.7065e-19, 5.68e-19, 5.8032e-19, 5.889e-19, 6.0014e-19, 5.9514e-19, 5.8115e-19, 5.6088e-19, 5.5239e-19, 5.5815e-19, 5.8809e-19, 6.0913e-19, 6.1591e-19, 6.0887e-19, 6.1096e-19, 6.0828e-19, 5.9583e-19, 5.7492e-19, 5.7238e-19, 5.8632e-19, 6.1358e-19, 6.1719e-19, 5.9972e-19, 5.7863e-19, 5.6324e-19, 5.4225e-19, 5.3326e-19, 5.3336e-19, 5.4519e-19, 5.5347e-19, 5.6267e-19, 5.6443e-19, 5.7481e-19, 5.818e-19, 5.8717e-19, 5.853e-19, 5.8574e-19, 5.8579e-19, 5.878e-19, 5.8291e-19, 5.8722e-19, 5.8985e-19, 5.891e-19, 5.698e-19, 5.4286e-19, 5.1448e-19, 5.07e-19, 5.2014e-19, 5.4597e-19, 5.5329e-19, 5.4265e-19, 5.1674e-19, 5.0223e-19, 5.1025e-19, 5.3564e-19, 5.4621e-19, 5.3656e-19, 5.1228e-19, 5.0299e-19, 5.1272e-19, 5.3396e-19, 5.4753e-19, 5.6694e-19, 5.7559e-19, 5.6469e-19, 5.3672e-19, 5.0688e-19, 4.7509e-19, 4.6269e-19, 4.7747e-19, 5.1975e-19, 5.4462e-19, 5.355e-19, 4.9787e-19, 4.6326e-19, 4.3622e-19, 4.2487e-19, 4.2609e-19, 4.3807e-19, 4.5134e-19, 4.7597e-19, 5.04e-19, 5.1897e-19, 5.0455e-19, 4.8184e-19, 4.6081e-19, 4.6769e-19, 4.9908e-19, 5.2818e-19, 5.1533e-19, 4.824e-19, 4.5203e-19, 4.4264e-19, 4.4128e-19, 4.4056e-19, 4.3882e-19, 4.4479e-19, 4.4365e-19, 4.3741e-19, 4.2276e-19, 4.1726e-19, 4.2003e-19, 4.206e-19, 4.1319e-19, 4.041e-19, 3.9907e-19, 4.1593e-19, 4.3513e-19, 4.3997e-19, 4.2693e-19, 4.2006e-19, 4.2336e-19, 4.3223e-19, 4.2611e-19, 4.1246e-19, 4.0126e-19, 4.1313e-19, 4.3643e-19, 4.468e-19, 4.3066e-19, 4.0922e-19, 3.7955e-19, 3.5403e-19, 3.4473e-19, 3.62e-19, 3.7895e-19, 3.8383e-19, 3.7256e-19, 3.5698e-19, 3.4026e-19, 3.324e-19, 3.2902e-19, 3.3034e-19, 3.277e-19, 3.3272e-19, 3.3587e-19, 3.4421e-19, 3.6141e-19, 3.8979e-19, 4.038e-19, 4.0483e-19, 3.8933e-19, 3.6918e-19, 3.4838e-19, 3.3527e-19, 3.2572e-19, 3.2206e-19, 3.197e-19, 3.2706e-19, 3.3925e-19, 3.4571e-19, 3.3801e-19, 3.3104e-19, 3.2211e-19, 3.0747e-19, 2.873e-19, 2.706e-19, 2.5878e-19, 2.5857e-19, 2.6261e-19, 2.6883e-19, 2.7049e-19, 2.7067e-19, 2.6622e-19, 2.6647e-19, 2.7598e-19, 3.0043e-19, 3.2674e-19, 3.3594e-19, 3.2272e-19, 3.0157e-19, 2.7682e-19, 2.5904e-19, 2.5138e-19, 2.5161e-19, 2.5382e-19, 2.6353e-19, 2.7465e-19, 2.8592e-19, 2.8945e-19, 2.8825e-19, 2.8479e-19, 2.7975e-19, 2.6484e-19, 2.4476e-19, 2.2427e-19, 2.0875e-19, 1.9537e-19, 1.8605e-19, 1.8087e-19, 1.8211e-19, 1.8672e-19, 1.9459e-19, 2.0628e-19, 2.2154e-19, 2.2789e-19, 2.2682e-19, 2.3175e-19, 2.4547e-19, 2.486e-19, 2.3837e-19, 2.255e-19, 2.1602e-19, 2.0643e-19, 2.0183e-19, 2.0338e-19, 2.1168e-19, 2.205e-19, 2.2773e-19, 2.2749e-19, 2.2424e-19, 2.1897e-19, 2.1538e-19, 2.1184e-19, 2.0515e-19, 1.9223e-19, 1.8114e-19, 1.7185e-19, 1.6427e-19, 1.5753e-19, 1.536e-19, 1.4895e-19, 1.4504e-19, 1.4393e-19, 1.504e-19, 1.6004e-19, 1.6604e-19, 1.6728e-19, 1.6703e-19, 1.6255e-19, 1.5599e-19, 1.4933e-19, 1.4645e-19, 1.4564e-19, 1.4677e-19, 1.4691e-19, 1.517e-19, 1.631e-19, 1.7628e-19, 1.8218e-19, 1.8255e-19, 1.7695e-19, 1.6891e-19, 1.6294e-19, 1.5881e-19, 1.5219e-19, 1.4666e-19, 1.4258e-19, 1.4276e-19, 1.4181e-19, 1.4111e-19, 1.4033e-19, 1.4021e-19, 1.3715e-19, 1.314e-19, 1.2369e-19, 1.1675e-19, 1.0805e-19, 1.0019e-19, 9.5353e-20, 9.3997e-20, 9.2499e-20, 9.3639e-20, 9.8914e-20, 1.0618e-19, 1.0899e-19, 1.0722e-19, 1.0065e-19, 9.5742e-20, 9.6095e-20, 1.0346e-19, 1.1249e-19, 1.1972e-19, 1.23e-19, 1.2266e-19, 1.1951e-19, 1.1963e-19, 1.2151e-19, 1.194e-19, 1.1285e-19, 1.0887e-19, 1.0968e-19, 1.1332e-19, 1.1403e-19, 1.1394e-19, 1.1228e-19, 1.0805e-19, 1.0141e-19, 9.5917e-20, 9.0934e-20, 8.9281e-20, 9.0123e-20, 9.3094e-20, 9.3461e-20, 9.0636e-20, 8.5083e-20, 7.8718e-20, 7.2641e-20, 6.8512e-20, 6.581e-20, 6.5283e-20, 6.4483e-20, 6.4357e-20, 6.3044e-20, 6.0642e-20, 5.8477e-20, 5.8677e-20, 6.0073e-20, 6.2399e-20, 6.4377e-20, 6.7071e-20, 7.0448e-20, 7.6604e-20, 8.3433e-20, 8.8836e-20, 9.0505e-20, 8.7802e-20, 8.0408e-20, 7.1782e-20, 6.5497e-20, 6.4533e-20, 6.6641e-20, 6.9814e-20, 7.0062e-20, 6.9593e-20, 6.9982e-20, 7.3282e-20, 7.6942e-20, 7.9223e-20, 7.8507e-20, 7.5907e-20, 7.0184e-20, 6.4529e-20, 5.861e-20, 5.3989e-20, 4.9726e-20, 4.6367e-20, 4.2335e-20, 3.9595e-20, 3.7643e-20, 3.7783e-20, 3.9356e-20, 4.266e-20, 4.5673e-20, 4.7595e-20, 4.7217e-20, 4.5677e-20, 4.2522e-20, 3.999e-20, 3.7756e-20, 3.6907e-20, 3.6932e-20, 3.799e-20, 3.9907e-20, 4.3161e-20, 4.6133e-20, 4.8097e-20, 4.804e-20, 4.7277e-20, 4.5466e-20, 4.3652e-20, 4.1291e-20, 4.0842e-20, 4.186e-20, 4.4735e-20, 4.7082e-20, 4.9368e-20, 5.0422e-20, 5.3432e-20, 5.5581e-20, 5.6369e-20, 5.3601e-20, 4.8904e-20, 4.2997e-20, 3.8476e-20, 3.4208e-20, 3.2493e-20, 3.1362e-20, 3.1069e-20, 3.0886e-20, 3.1375e-20, 3.2114e-20, 3.3537e-20, 3.4715e-20, 3.63e-20, 3.6483e-20, 3.6527e-20, 3.5437e-20, 3.4087e-20, 3.1099e-20, 2.7774e-20, 2.4156e-20, 2.212e-20, 2.0316e-20, 2.0163e-20, 1.9894e-20, 2.009e-20, 1.9896e-20, 2.0287e-20, 2.0496e-20, 2.0914e-20, 2.1015e-20, 2.1385e-20, 2.1129e-20, 2.1854e-20, 2.3274e-20, 2.6873e-20, 3.0245e-20, 3.4328e-20, 3.5094e-20, 3.3292e-20, 3.0927e-20, 3.0061e-20, 2.8439e-20, 2.8819e-20, 2.981e-20, 3.1676e-20, 3.156e-20, 3.0372e-20, 2.7037e-20, 2.5347e-20, 2.4298e-20, 2.54e-20, 2.5589e-20, 2.5448e-20, 2.337e-20, 2.3189e-20, 2.1531e-20, 2.2401e-20, 2.0649e-20, 2.1229e-20, 1.8512e-20, 2.0828e-20, 1.8089e-20, 1.9482e-20, 1.7591e-20, 1.9512e-20, 1.7651e-20, 1.8531e-20, 1.5131e-20, 1.7391e-20, 1.5929e-20, 1.7851e-20, 1.5121e-20, 1.7053e-20, 1.4852e-20, 1.6548e-20, 1.3715e-20, 1.6155e-20, 1.3674e-20, 1.6038e-20, 1.2882e-20, 1.5959e-20, 1.2881e-20, 1.5588e-20, 1.1888e-20, 1.5273e-20, 1.276e-20, 1.5122e-20, 1.188e-20, 1.527e-20, 1.218e-20, 1.5019e-20, 1.1506e-20, 1.4827e-20, 1.1273e-20, 1.4742e-20, 1.1055e-20, 1.4627e-20, 1.1803e-20, 1.4655e-20, 1.1758e-20, 1.4535e-20, 1.0803e-20, 1.4187e-20, 1.0866e-20, 1.4698e-20, 1.1505e-20, 1.4046e-20, 1.1202e-20, 1.4457e-20, }; nw = nw_in; if (!(xsno2 = new double[nw])) { InputError(ERROR, "Unable to allocate memory in \"NO2Bands\""); exit (3); } Rebin(NNO2, wno2, xno2tpl, nw, wl, xsno2); }