70 const Agenda& forloop_agenda,
79 for (
Index i=start; i<=stop; i+=step)
81 out1 <<
" Executing for loop body, index: " << i <<
"\n";
105 if (direction==
"row")
107 if( index >= m.
nrows() )
110 os <<
"The index " << index
111 <<
" is outside the row range of the Matrix.";
112 throw runtime_error( os.str() );
117 v = m( index,
joker );
119 else if (direction==
"column")
121 if( index >= m.
ncols() )
124 os <<
"The index " << index
125 <<
" is outside the column range of the Matrix.";
126 throw runtime_error( os.str() );
131 v = m(
joker, index );
136 os <<
"Keyword *direction* must be either *row* or *column*,"
137 <<
"but you gave: " << direction <<
".";
138 throw runtime_error( os.str() );
155 if (direction==
"page")
157 if( index >= t3.
npages() )
160 os <<
"The index " << index
161 <<
" is outside the page range of the Matrix.";
162 throw runtime_error( os.str() );
169 else if (direction==
"row")
171 if( index >= t3.
nrows() )
174 os <<
"The index " << index
175 <<
" is outside the row range of the Matrix.";
176 throw runtime_error( os.str() );
183 else if (direction==
"column")
185 if( index >= t3.
ncols() )
188 os <<
"The index " << index
189 <<
" is outside the column range of the Matrix.";
190 throw runtime_error( os.str() );
200 os <<
"Keyword *direction* must be either *page* or *row* or *column*,"
201 <<
"but you gave: " << direction <<
".";
202 throw runtime_error( os.str() );
214 const Index& ybatch_start,
215 const Index& ybatch_n,
216 const Agenda& ybatch_calc_agenda,
223 Index first_ybatch_index = 0;
226 bool do_abort =
false;
238 Index job_counter = 0;
241 ybatch.resize(ybatch_n);
242 ybatch_aux.resize(ybatch_n);
243 ybatch_jacobians.resize(ybatch_n);
248 Agenda l_ybatch_calc_agenda(ybatch_calc_agenda);
253 #pragma omp parallel for \
255 if (!arts_omp_in_parallel() \
257 firstprivate(l_ws, l_ybatch_calc_agenda)
258 for(
Index ybatch_index = first_ybatch_index;
259 ybatch_index<ybatch_n;
264 if (do_abort)
continue;
265 #pragma omp critical (ybatchCalc_job_counter)
267 l_job_counter = ++job_counter;
272 os <<
" Job " << l_job_counter <<
" of " << ybatch_n
273 <<
", Index " << ybatch_start+ybatch_index <<
", Thread-Id "
285 ybatch_start+ybatch_index,
286 l_ybatch_calc_agenda);
290 #pragma omp critical (ybatchCalc_assign_y)
291 ybatch[ybatch_index] = y;
292 #pragma omp critical (ybatchCalc_assign_y_aux)
293 ybatch_aux[ybatch_index] = y_aux;
299 if (Knr != 0 || Knc != 0)
301 if (Knr != y.
nelem())
304 os <<
"First dimension of Jacobian must have same length as the measurement *y*.\n"
305 <<
"Length of *y*: " << y.
nelem() <<
"\n"
306 <<
"Dimensions of *jacobian*: (" << Knr <<
", " << Knc <<
")\n";
311 #pragma omp critical (ybatchCalc_setabort)
314 throw runtime_error(os.str());
317 ybatch_jacobians[ybatch_index] = jacobian;
324 catch (runtime_error e)
326 if (robust && !do_abort)
329 os <<
"WARNING! Job at ybatch_index " << ybatch_start+ybatch_index <<
" failed.\n"
330 <<
"y Vector in output variable ybatch will be empty for this job.\n"
331 <<
"The runtime error produced was:\n"
339 #pragma omp critical (ybatchCalc_setabort)
343 os <<
" Job at ybatch_index "
344 << ybatch_start+ybatch_index <<
" failed. Aborting...\n";
348 os <<
"Run-time error at ybatch_index "
349 << ybatch_start+ybatch_index <<
": \n" << e.what();
350 #pragma omp critical (ybatchCalc_push_fail_msg)
351 fail_msg.push_back(os.str());
355 if (fail_msg.
nelem())
359 if (!do_abort) os <<
"\nError messages from failed batch cases:\n";
360 for (ArrayOfString::const_iterator it = fail_msg.begin(); it != fail_msg.end(); it++)
364 throw runtime_error(os.str());
379 const Agenda& met_profile_calc_agenda,
381 const Matrix& met_amsu_data,
383 const Vector& refellipsoid,
386 const Index& atmosphere_dim,
389 const Index& nelem_p_grid,
390 const String& met_profile_path,
391 const String& met_profile_pnd_path,
410 vmr_field_raw.resize(abs_species.
nelem());
417 pnd_field_raw.resize(N_pt);
436 ybatch.resize(no_profiles);
439 for (
Index i = 0; i < no_profiles; ++ i)
441 ostringstream lat_os, lon_os;
444 if(lat[i] < 0) lat_prec--;
448 if(
abs(lat[i])>=100 ) lat_prec--;
451 lat_os.setf (ios::showpoint | ios::fixed);
452 lat_os << setprecision((
int)lat_prec) << lat[i];
455 if(lon[i] < 0) lon_prec--;
459 if(
abs(lon[i])>=100 ) lon_prec--;
461 lon_os.setf (ios::showpoint | ios::fixed);
462 lon_os << setprecision((
int)lon_prec) << lon[i];
465 180.0 - (asin(refellipsoid[0] * sin(sat_za_from_data[i] *
DEG2RAD) /sensor_pos(0,0)))*
RAD2DEG;
468 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".t.xml",
469 t_field_raw, verbosity);
472 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".z.xml",
473 z_field_raw, verbosity);
476 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".H2O.xml",
477 vmr_field_raw[0], verbosity);
484 xml_read_from_file(met_profile_pnd_path +
"lwc_reff15/profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".pnd15.xml",
485 pnd_field_raw[0], verbosity);
490 z_surface(0,0) = z_field_raw.
data(0,0,0);
504 vmr_field_raw[1].resize(vmr_field_raw[0]);
505 vmr_field_raw[1].copy_grids(vmr_field_raw[0]);
506 vmr_field_raw[1] = 0.782;
512 vmr_field_raw[2].resize(vmr_field_raw[0]);
513 vmr_field_raw[2].copy_grids(vmr_field_raw[0]);
514 vmr_field_raw[2] = 0.209;
531 Numeric cl_grid_min, cl_grid_max;
535 cl_grid_min = tfr_p_grid[0];
538 Index level_counter = 0;
541 for (
Index ip = 0; ip< N_p; ++ip)
546 if(pnd_field_raw[0].data(ip, 0, 0) > 0.001)
553 cl_grid_max = tfr_p_grid[ip +1];
558 cloudbox_limits.resize( atmosphere_dim*2 );
563 if(level_counter == 0)
565 cl_grid_max = p_grid[1];
588 z_field_raw, pnd_field_raw, p_grid,
589 sensor_los, cloudbox_on,
590 cloudbox_limits, z_surface,
591 met_profile_calc_agenda );
608 const Agenda& met_profile_calc_agenda,
610 const Matrix& met_amsu_data,
612 const Vector& refellipsoid,
614 const Index& nelem_p_grid,
615 const String& met_profile_path,
624 Index cloudbox_on = 0;
634 vmr_field_raw.resize(abs_species.
nelem());
637 ybatch.resize(no_profiles);
639 Vector sat_za_from_profile;
640 sat_za_from_profile = met_amsu_data(
Range(
joker),3);
653 for (
Index i = 0; i < no_profiles; ++ i)
655 ostringstream lat_os, lon_os;
658 if(lat[i] < 0) lat_prec--;
662 if(
abs(lat[i])>=100 ) lat_prec--;
665 lat_os.setf (ios::showpoint | ios::fixed);
666 lat_os << setprecision((
int)lat_prec) << lat[i];
669 if(lon[i] < 0) lon_prec--;
673 if(
abs(lon[i])>=100 ) lon_prec--;
675 lon_os.setf (ios::showpoint | ios::fixed);
676 lon_os << setprecision((
int)lon_prec) << lon[i];
677 cout<<lat_os.str()<<endl;
678 cout<<lon_os.str()<<endl;
681 sat_za = sat_za_from_profile[i];
684 180.0 - (asin(refellipsoid[0] * sin(sat_za *
PI/180.) /sensor_pos(0,0)))*180./
PI;
685 cout<<
"sensor_los"<<sat_za_from_profile[i]<<endl;
686 cout<<
"sensor_los"<<sat_za<<endl;
687 cout<<
"sensor_los"<<sensor_los<<endl;
690 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".t.xml",
691 t_field_raw, verbosity);
693 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".z.xml",
694 z_field_raw, verbosity);
699 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".H2O.xml",
700 vmr_field_raw_h2o, verbosity);
704 cout <<
"--------------------------------------------------------------------------"<<endl;
705 cout <<
"The file" << met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str()<<
"is executed now"<<endl;
706 cout <<
"--------------------------------------------------------------------------"<<endl;
712 z_surface(0,0) = z_field_raw.
data(0,0,0);
713 cout<<
"z_surface"<<z_surface<<endl;
717 vmr_field_raw[0] = vmr_field_raw_h2o;
723 vmr_field_raw[1].resize(vmr_field_raw[0]);
724 vmr_field_raw[1].copy_grids(vmr_field_raw[0]);
731 vmr_field_raw[2].resize(vmr_field_raw[0]);
732 vmr_field_raw[2].copy_grids(vmr_field_raw[0]);
746 cout<<
"t_field_raw[0](0,0,0)"<<tfr_p_grid[0]<<endl;
747 cout<<
"t_field_raw[0](N_p -1,0,0)"<<tfr_p_grid[N_p -1] <<endl;
752 z_field_raw, pnd_field_raw, p_grid,
753 sensor_los, cloudbox_on,
754 cloudbox_limits, z_surface,
755 met_profile_calc_agenda );