40 return os <<
"\n Main tag = " << ot.
MainTag()
41 <<
"\n Sub tag = " << ot.
Subtag()
42 <<
"\n Mode = " << ot.
Mode()
75 for(
Index irow=0; irow<diy_dx.
nrows(); irow++ )
77 for(
Index icol=0; icol<diy_dx.
ncols(); icol++ )
78 { diy_dx(irow,icol) += w * diy_dq(irow,icol); }
102 else if( gp[i].fd[0] > 1 )
114 const Index& atmosphere_dim,
120 const Numeric extpolfac = 1.0e99;
129 p2gridpos( gp_p, jacobian_quantity.
Grids()[0], ppath_p, extpolfac );
138 if( atmosphere_dim > 1 )
140 gp_lat.resize(ppath.
np);
154 if( atmosphere_dim > 2 )
156 gp_lon.resize(ppath.
np);
157 if( jacobian_quantity.
Grids()[2].
nelem() > 1 )
168 if( atmosphere_dim == 1 )
170 for(
Index ip=0; ip<ppath.
np; ip++ )
172 if( gp_p[ip].fd[1] > 0 )
177 if( gp_p[ip].fd[0] > 0 )
186 else if( atmosphere_dim == 2 )
188 for(
Index ip=0; ip<ppath.
np; ip++ )
190 Index ix = nr1*gp_lat[ip].idx + gp_p[ip].idx;
192 if( gp_lat[ip].fd[1]>0 && gp_p[ip].fd[1]>0 )
195 gp_lat[ip].fd[1]*gp_p[ip].fd[1] );
197 if( gp_lat[ip].fd[1]>0 && gp_p[ip].fd[0]>0 )
200 gp_lat[ip].fd[1]*gp_p[ip].fd[0] );
202 if( gp_lat[ip].fd[0]>0 && gp_p[ip].fd[1]>0 )
205 gp_lat[ip].fd[0]*gp_p[ip].fd[1] );
207 if( gp_lat[ip].fd[0]>0 && gp_p[ip].fd[0]>0 )
210 gp_lat[ip].fd[0]*gp_p[ip].fd[0] );
215 else if( atmosphere_dim == 3 )
217 for(
Index ip=0; ip<ppath.
np; ip++ )
219 Index ix = nr2*nr1*gp_lon[ip].idx +
220 nr1*gp_lat[ip].idx + gp_p[ip].idx;
222 if( gp_lon[ip].fd[1]>0 && gp_lat[ip].fd[1]>0 && gp_p[ip].fd[1]>0 )
225 gp_lon[ip].fd[1]*gp_lat[ip].fd[1]*gp_p[ip].fd[1]);
227 if( gp_lon[ip].fd[1]>0 && gp_lat[ip].fd[1]>0 && gp_p[ip].fd[0]>0 )
230 gp_lon[ip].fd[1]*gp_lat[ip].fd[1]*gp_p[ip].fd[0]);
232 if( gp_lon[ip].fd[1]>0 && gp_lat[ip].fd[0]>0 && gp_p[ip].fd[1]>0 )
235 gp_lon[ip].fd[1]*gp_lat[ip].fd[0]*gp_p[ip].fd[1]);
237 if( gp_lon[ip].fd[1]>0 && gp_lat[ip].fd[0]>0 && gp_p[ip].fd[0]>0 )
240 gp_lon[ip].fd[1]*gp_lat[ip].fd[0]*gp_p[ip].fd[0]);
246 if( gp_lon[ip].fd[0]>0 && gp_lat[ip].fd[1]>0 && gp_p[ip].fd[1]>0 )
249 gp_lon[ip].fd[0]*gp_lat[ip].fd[1]*gp_p[ip].fd[1]);
251 if( gp_lon[ip].fd[0]>0 && gp_lat[ip].fd[1]>0 && gp_p[ip].fd[0]>0 )
254 gp_lon[ip].fd[0]*gp_lat[ip].fd[1]*gp_p[ip].fd[0]);
256 if( gp_lon[ip].fd[0]>0 && gp_lat[ip].fd[0]>0 && gp_p[ip].fd[1]>0 )
259 gp_lon[ip].fd[0]*gp_lat[ip].fd[0]*gp_p[ip].fd[1]);
261 if( gp_lon[ip].fd[0]>0 && gp_lat[ip].fd[0]>0 && gp_p[ip].fd[0]>0 )
264 gp_lon[ip].fd[0]*gp_lat[ip].fd[0]*gp_p[ip].fd[0]);
302 if( jacobian_quantities[iq].MainTag() == TEMPERATURE_MAINTAG )
307 if( jacobian_quantities[iq].MainTag() == ABSSPECIES_MAINTAG )
311 abs_species_i[iq] =
chk_contains(
"abs_species", abs_species, atag );
314 { abs_species_i[iq] = -1; }
316 if( jacobian_quantities[iq].MainTag() == WIND_MAINTAG )
319 char c = jacobian_quantities[iq].Subtag()[0];
320 wind_i[iq] =
Index( c ) - 116;
358 for (
Index lat_it=0; lat_it<nd.
nrows(); lat_it++)
360 for (
Index lon_it=0; lon_it<nd.
ncols(); lon_it++)
362 nd(p_it,lat_it,lon_it) =
number_density( p[p_it], t(p_it,lat_it,lon_it));
404 const String& p_retr_name,
405 const String& lat_retr_name,
406 const String& lon_retr_name,
409 if ( p_retr.
nelem()==0 )
411 os <<
"The grid vector *" << p_retr_name <<
"* is empty," 412 <<
" at least one pressure level\n" 413 <<
"should be specified.";
418 os <<
"The pressure grid vector *" << p_retr_name <<
"* is not a\n" 419 <<
"strictly decreasing vector, which is required.";
422 else if ( log(p_retr[0])> 1.5*log(p_grid[0])-0.5*log(p_grid[1]) ||
423 log(p_retr[p_retr.
nelem()-1])<1.5*log(p_grid[p_grid.
nelem()-1])-
424 0.5*log(p_grid[p_grid.
nelem()-2]))
426 os <<
"The grid vector *" << p_retr_name <<
"* is not covered by the\n" 427 <<
"corresponding atmospheric grid.";
439 if ( lat_retr.
nelem()==0 )
441 os <<
"The grid vector *" << lat_retr_name <<
"* is empty," 442 <<
" at least one latitude\n" 443 <<
"should be specified for a 2D/3D atmosphere.";
448 os <<
"The latitude grid vector *" << lat_retr_name <<
"* is not a\n" 449 <<
"strictly increasing vector, which is required.";
452 else if ( lat_retr[0]<1.5*lat_grid[0]-0.5*lat_grid[1] ||
453 lat_retr[lat_retr.
nelem()-1]>1.5*lat_grid[lat_grid.
nelem()-1]-
454 0.5*lat_grid[lat_grid.
nelem()-2] )
456 os <<
"The grid vector *" << lat_retr_name <<
"* is not covered by the\n" 457 <<
"corresponding atmospheric grid.";
468 if ( lon_retr.
nelem()==0 )
470 os <<
"The grid vector *" << lon_retr_name <<
"* is empty," 471 <<
" at least one longitude\n" 472 <<
"should be specified for a 3D atmosphere.";
477 os <<
"The longitude grid vector *" << lon_retr_name <<
"* is not a\n" 478 <<
"strictly increasing vector, which is required.";
481 else if ( lon_retr[0]<1.5*lon_grid[0]-0.5*lon_grid[1] ||
482 lon_retr[lon_retr.
nelem()-1]>1.5*lon_grid[lon_grid.
nelem()-1]-
483 0.5*lon_grid[lon_grid.
nelem()-2] )
485 os <<
"The grid vector *" << lon_retr_name <<
"* is not covered by the\n" 486 <<
"corresponding atmospheric grid.";
524 const bool& is_pressure)
533 pert[0] = atm_grid[0]*10.0;
534 pert[nj+1] = atm_grid[na-1]*0.1;
538 pert[0] = atm_grid[0]-1.0;
539 pert[nj+1] = atm_grid[na-1]+1.0;
541 pert[
Range(1,nj)] = jac_grid;
600 while (inc*pert_grid[limit[0]+1] < inc*atm_limit[0])
606 limit[1]=pert_grid.
nelem();
607 while (inc*pert_grid[limit[1]-1] > inc*atm_limit[na])
612 assert(limit[1]>limit[0]);
637 range =
Range(index,2);
638 else if (index==length-1)
639 range =
Range(index+1,2);
641 range =
Range(index+1,1);
664 const Index& p_pert_n,
665 const Range& p_range,
675 pert_field[p_range] += size;
676 interp( pert, itw, pert_field, p_gp);
710 const Index& p_pert_n,
711 const Index& lat_pert_n,
712 const Range& p_range,
713 const Range& lat_range,
723 pert_field(p_range,lat_range) += size;
724 interp( pert, itw, pert_field, p_gp, lat_gp);
762 const Index& p_pert_n,
763 const Index& lat_pert_n,
764 const Index& lon_pert_n,
765 const Range& p_range,
766 const Range& lat_range,
767 const Range& lon_range,
776 Tensor3 pert_field(p_pert_n,lat_pert_n,lon_pert_n,1.0-(
Numeric)method);
777 pert_field(p_range,lat_range,lon_range) += size;
778 interp( pert, itw, pert_field, p_gp, lat_gp, lon_gp);
808 const Index& poly_coeff )
812 assert( l > poly_coeff );
817 if( poly_coeff == 0 )
824 for(
Index i=0; i<l; i++ )
826 b[i] = ( x[i] - xmin ) / dx - 1.0;
827 b[i] = pow( b[i],
int(poly_coeff) );
860 if( unit ==
"rel" || unit ==
"logrel" )
862 else if( unit ==
"vmr" )
864 else if( unit ==
"nd" )
868 throw runtime_error(
"Allowed options for gas species jacobians are " 869 "\"rel\", \"vmr\", \"nd\" and \"logrel\"." );
INDEX Index
The type to use for all integer numbers and indices.
void get_perturbation_limit(ArrayOfIndex &limit, const Vector &pert_grid, const Vector &atm_limit)
Get limits for perturbation of a box.
const ArrayOfVector & Grids() const
Grids.
void perturbation_field_1d(VectorView field, const ArrayOfGridPos &p_gp, const Index &p_pert_n, const Range &p_range, const Numeric &size, const Index &method)
Calculate the 1D perturbation for a relative perturbation.
const String TEMPERATURE_MAINTAG
Index nelem() const
Number of elements.
const Index & Analytical() const
Boolean to make analytical calculations (if possible).
void gp4length1grid(ArrayOfGridPos &gp)
Declarations required for the calculation of jacobians.
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
void from_dpath_to_dx(MatrixView diy_dx, ConstMatrixView diy_dq, const Numeric &w)
diy_from_path_to_rgrids
const String ABSSPECIES_MAINTAG
void get_perturbation_range(Range &range, const Index &index, const Index &length)
Get range for perturbation.
cmplx FADDEEVA() w(cmplx z, double relerr)
bool check_retrieval_grids(ArrayOfVector &grids, ostringstream &os, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &p_retr, const Vector &lat_retr, const Vector &lon_retr, const String &p_retr_name, const String &lat_retr_name, const String &lon_retr_name, const Index &dim)
Check that the retrieval grids are defined for each atmosphere dim.
void p2gridpos(ArrayOfGridPos &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Numeric &extpolfac)
p2gridpos
const String WIND_MAINTAG
Index nrows() const
Returns the number of rows.
void perturbation_field_3d(Tensor3View field, const ArrayOfGridPos &p_gp, const ArrayOfGridPos &lat_gp, const ArrayOfGridPos &lon_gp, const Index &p_pert_n, const Index &lat_pert_n, const Index &lon_pert_n, const Range &p_range, const Range &lat_range, const Range &lon_range, const Numeric &size, const Index &method)
Calculate the 3D perturbation for a relative perturbation.
#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do)
Numeric number_density(const Numeric &p, const Numeric &t)
number_density
Index nelem() const
Returns the number of elements.
Contains the data for one retrieval quantity.
The implementation for String, the ARTS string class.
Index ncols() const
Returns the number of columns.
void get_pointers_for_analytical_jacobians(ArrayOfIndex &abs_species_i, ArrayOfIndex &is_t, ArrayOfIndex &wind_i, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfSpeciesTag &abs_species)
Help function for analytical jacobian calculations.
The global header file for ARTS.
ostream & operator<<(ostream &os, const RetrievalQuantity &ot)
Output operator for RetrievalQuantity.
void vmrunitscf(Numeric &x, const String &unit, const Numeric &vmr, const Numeric &p, const Numeric &t)
vmrunitscf
Index ncols() const
Returns the number of columns.
const String & Mode() const
Calculation mode.
const String & MainTag() const
Main tag.
void gridpos(ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac)
Set up a grid position Array.
NUMERIC Numeric
The type to use for all floating point numbers.
void add_extrap(ArrayOfGridPos &gp)
Header file for special_interp.cc.
Index npages() const
Returns the number of pages.
void resize(Index n)
Assignment operator from VectorView.
A constant view of a Tensor3.
void get_perturbation_gridpos(ArrayOfGridPos &gp, const Vector &atm_grid, const Vector &jac_grid, const bool &is_pressure)
Calculate array of GridPos for perturbation interpolation.
A constant view of a Vector.
void diy_from_path_to_rgrids(Tensor3View diy_dx, const RetrievalQuantity &jacobian_quantity, ConstTensor3View diy_dpath, const Index &atmosphere_dim, const Ppath &ppath, ConstVectorView ppath_p)
Numeric mean(const ConstVectorView &x)
Mean function, vector version.
void calc_nd_field(Tensor3View &nd, const VectorView &p, const Tensor3View &t)
Calculate the number density field.
void polynomial_basis_func(Vector &b, const Vector &x, const Index &poly_coeff)
Calculates polynomial basis functions.
A constant view of a Matrix.
bool is_decreasing(ConstVectorView x)
Checks if a vector is sorted in reversed order and is strictly decreasing.
void perturbation_field_2d(MatrixView field, const ArrayOfGridPos &p_gp, const ArrayOfGridPos &lat_gp, const Index &p_pert_n, const Index &lat_pert_n, const Range &p_range, const Range &lat_range, const Numeric &size, const Index &method)
Calculate the 2D perturbation for a relative perturbation.
The structure to describe a propagation path and releated quantities.
const String & Subtag() const
Subtag.
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
Index nrows() const
Returns the number of rows.