76                             const Index& atmosphere_dim,
    82   if (atmosphere_dim == 1) {
    87   else if (atmosphere_dim == 2) {
    88     assert(gp_lat.
nelem() == n);
    93   else if (atmosphere_dim == 3) {
    94     assert(gp_lat.
nelem() == n);
    95     assert(gp_lon.
nelem() == n);
   102                             const Index& atmosphere_dim,
   110   if (atmosphere_dim == 1) {
   111     assert(itw.
ncols() == 2);
   115   else if (atmosphere_dim == 2) {
   116     assert(itw.
ncols() == 4);
   120   else if (atmosphere_dim == 3) {
   121     assert(itw.
ncols() == 8);
   122     interp(x, itw, x_field, gp_p, gp_lat, gp_lon);
   127                            const Index& atmosphere_dim,
   148   if (atmosphere_dim > 1) {
   153   if (atmosphere_dim > 2) {
   172                               const Index& atmosphere_dim,
   175   if (atmosphere_dim == 1) {
   177     gp_p_out.
idx -= cloudbox_limits[0];
   179     assert(itw.
nelem() == 2);
   181   } 
else if (atmosphere_dim == 2) {
   184     gp_p_out.
idx -= cloudbox_limits[0];
   185     gp_lat_out.
idx -= cloudbox_limits[2];
   188     assert(itw.
nelem() == 4);
   194     gp_p_out.
idx -= cloudbox_limits[0];
   195     gp_lat_out.
idx -= cloudbox_limits[2];
   196     gp_lon_out.
idx -= cloudbox_limits[4];
   200     assert(itw.
nelem() == 8);
   225                               const Index& atmosphere_dim,
   228   if (atmosphere_dim == 1) {
   233   else if (atmosphere_dim == 2) {
   239   else if (atmosphere_dim == 3) {
   241     assert(n == gp_lon.
nelem());
   248                               const Index& atmosphere_dim,
   253   if (atmosphere_dim == 1) {
   254     assert(itw.
ncols() == 1);
   258   else if (atmosphere_dim == 2) {
   260     assert(itw.
ncols() == 2);
   264   else if (atmosphere_dim == 3) {
   266     assert(itw.
ncols() == 4);
   267     interp(x, itw, x_surface, gp_lat, gp_lon);
   272                              const Index& atmosphere_dim,
   289   if (atmosphere_dim > 1) {
   294   if (atmosphere_dim > 2) {
   311                            const Index& atmosphere_dim,
   318   if (atmosphere_dim == 1) {
   319     field_new.
resize(n1, 1, 1);
   323   } 
else if (atmosphere_dim == 2) {
   325     field_new.
resize(n1, n2, 1);
   333   } 
else if (atmosphere_dim == 3) {
   336     field_new.
resize(n1, n2, n3);
   339     interp(field_new, itw, field_old, gp_p, gp_lat, gp_lon);
   344                           const Index& atmosphere_dim,
   348   if (atmosphere_dim == 1) {
   349     field_new = field_old;
   350   } 
else if (atmosphere_dim == 2) {
   356   } 
else if (atmosphere_dim == 3) {
   362     interp(field_new, itw, field_old, gp_lat, gp_lon);
   370                            const Index& atmosphere_dim,
   377   if (atmosphere_dim >= 2) {
   384   if (atmosphere_dim >= 3) {
   395                           const Index& atmosphere_dim,
   398   if (atmosphere_dim >= 2) {
   405   if (atmosphere_dim >= 3) {
   420                            const Index& atmosphere_dim,
   426   const Numeric inf_proxy = 1.0e99;
   428   gp_p.resize(p_grid.
nelem());
   429   n_p = ret_grids[0].
nelem();
   431     p2gridpos(gp_p, ret_grids[0], p_grid, inf_proxy);
   437   if (atmosphere_dim >= 2) {
   438     gp_lat.resize(lat_grid.
nelem());
   439     n_lat = ret_grids[1].
nelem();
   441       gridpos(gp_lat, ret_grids[1], lat_grid, inf_proxy);
   451   if (atmosphere_dim >= 3) {
   452     gp_lon.resize(lon_grid.
nelem());
   453     n_lon = ret_grids[2].
nelem();
   455       gridpos(gp_lon, ret_grids[2], lon_grid, inf_proxy);
   471                            const Index& atmosphere_dim,
   476   const Numeric inf_proxy = 1.0e99;
   478   if (atmosphere_dim >= 2) {
   479     gp_lat.resize(lat_grid.
nelem());
   480     n_lat = ret_grids[0].
nelem();
   482       gridpos(gp_lat, ret_grids[0], lat_grid, inf_proxy);
   492   if (atmosphere_dim >= 3) {
   493     gp_lon.resize(lon_grid.
nelem());
   494     n_lon = ret_grids[1].
nelem();
   496       gridpos(gp_lon, ret_grids[1], lon_grid, inf_proxy);
   508                                const Index& atmosphere_dim,
   515   const bool np_is1 = field_old.
npages() == 1 ? true : 
false;
   516   const bool nlat_is1 =
   517       atmosphere_dim > 1 && field_old.
nrows() == 1 ? true : 
false;
   518   const bool nlon_is1 =
   519       atmosphere_dim > 2 && field_old.
ncols() == 1 ? true : 
false;
   522   if (!np_is1 && !nlat_is1 && !nlon_is1) {
   524         field_new, atmosphere_dim, field_old, gp_p, gp_lat, gp_lon);
   527     if (atmosphere_dim == 1) {  
   528       field_new.
resize(n1, 1, 1);
   529       field_new(
joker, 0, 0) = field_old(0, 0, 0);
   533     else if (atmosphere_dim == 2) {
   535       field_new.
resize(n1, n2, 1);
   537       if (np_is1 && nlat_is1)  
   540         field_new(
joker, 
joker, 0) = field_old(0, 0, 0);
   547         for (
Index p = 0; p < n1; p++) {
   548           assert(gp_p[p].fd[0] < 1e-6);
   549           field_new(p, 
joker, 0) = tmp;
   557         for (
Index lat = 0; lat < n2; lat++) {
   558           assert(gp_lat[lat].fd[0] < 1e-6);
   559           field_new(
joker, lat, 0) = tmp;
   565     else if (atmosphere_dim == 3) {
   568       field_new.
resize(n1, n2, n3);
   570       if (np_is1 && nlat_is1 && nlon_is1)  
   583           for (
Index p = 0; p < n1; p++) {
   584             assert(gp_p[p].fd[0] < 1e-6);
   585             for (
Index lat = 0; lat < n2; lat++) {
   586               assert(gp_lat[lat].fd[0] < 1e-6);
   587               field_new(p, lat, 
joker) = tmp;
   596           for (
Index p = 0; p < n1; p++) {
   597             assert(gp_p[p].fd[0] < 1e-6);
   598             for (
Index lon = 0; lon < n3; lon++) {
   599               assert(gp_lon[lon].fd[0] < 1e-6);
   600               field_new(p, 
joker, lon) = tmp;
   609           for (
Index p = 0; p < n1; p++) {
   610             assert(gp_p[p].fd[0] < 1e-6);
   618         if (nlat_is1 && nlon_is1)  
   624           for (
Index lat = 0; lat < n2; lat++) {
   625             assert(gp_lat[lat].fd[0] < 1e-6);
   626             for (
Index lon = 0; lon < n3; lon++) {
   627               assert(gp_lon[lon].fd[0] < 1e-6);
   628               field_new(
joker, lat, lon) = tmp;
   637           for (
Index lat = 0; lat < n2; lat++) {
   638             assert(gp_lat[lat].fd[0] < 1e-6);
   647           for (
Index lon = 0; lon < n3; lon++) {
   648             assert(gp_lon[lon].fd[0] < 1e-6);
   659                               const Index& atmosphere_dim,
   664   if (atmosphere_dim == 1) {
   665     field_new = field_old;
   667     const bool nlat_is1 = field_old.
nrows() == 1 ? true : 
false;
   668     const bool nlon_is1 =
   669         atmosphere_dim > 2 && field_old.
ncols() == 1 ? true : 
false;
   672     if (!nlat_is1 && !nlon_is1) {
   674           field_new, atmosphere_dim, field_old, gp_lat, gp_lon);
   676       if (atmosphere_dim == 2) {  
   679         field_new(
joker, 0) = field_old(0, 0);
   685         if (nlat_is1 && nlon_is1)  
   694           for (
Index lon = 0; lon < n2; lon++) {
   695             assert(gp_lon[lon].fd[0] < 1e-6);
   696             field_new(
joker, lon) = tmp;
   704           for (
Index lat = 0; lat < n1; lat++) {
   705             assert(gp_lat[lat].fd[0] < 1e-6);
   706             field_new(lat, 
joker) = tmp;
   722   assert(itw.
ncols() == 2);
   730   interp(p_values, itw, logpgrid, gp);
   770   gridpos(gp, logold, lognew, extpolfac);
   791                      const Index& atmosphere_dim,
   799   if (atmosphere_dim == 1) {
   801         "Altitude interpolation", z_field(
joker, 0, 0), rte_pos[0]);
   812     gridpos(gp_lat, lat_grid, rte_pos[1]);
   814     if (atmosphere_dim == 2) {
   823       gridpos(gp_lon, lon_grid, rte_pos[2]);
   831       interp(z_grid, itw, z_field, agp_z, agp_lat, agp_lon);
   836     gridpos(gp_p, z_grid, rte_pos[0]);
   842                      const Index& atmosphere_dim,
   848   if (atmosphere_dim == 1) {
   851     gridpos(gp_lat, lat_grid, rte_pos[1]);
   853     if (atmosphere_dim == 3) {
   855       gridpos(gp_lon, lon_grid, rte_pos[2]);
   872   assert(z.
nelem() == np);
   873   assert(z_field.nrows() == np);
   874   assert(z_field.ncols() == lat_grid.nelem());
   883   interp(z_matrix, itw, z_field, gp_z, agp_lat);
   903   assert(z.
nelem() == np);
   904   assert(z_field.npages() == np);
   905   assert(z_field.nrows() == lat_grid.nelem());
   906   assert(z_field.ncols() == lon_grid.
nelem());
   914   gridpos(agp_z, p_grid, p_grid);
   917   interp(z_tensor, itw, z_field, agp_z, agp_lat, agp_lon);
   933   Index gfield_fID = 0;
   934   Index gfield_tID = 1;
   935   Index gfield_compID = 2;
   947     os << 
"The data in *" << varname
   948        << 
"* must have exactly two pages. One page "   949        << 
"each\nfor the real and imaginary part of the complex refractive index.";
   959   assert(n_real.
nrows() == nf_out && n_real.
ncols() == nt_out);
   960   assert(n_imag.
nrows() == nf_out && n_imag.
ncols() == nt_out);
   967   Matrix nrf(nf_out, nt_in), nif(nf_out, nt_in);
   970     for (
Index i = 0; 
i < nf_out; 
i++) {
   979     gridpos(gp, f_grid_in, f_grid);
   990     for (
Index i = 0; 
i < nt_out; 
i++) {
   999     gridpos(gp, t_grid_in, t_grid);
  1001     for (
Index i = 0; 
i < nf_out; 
i++) {
 INDEX Index
The type to use for all integer numbers and indices. 
const ArrayOfVector & Grids() const
Returns the grids of the retrieval. 
void interp_atmsurface_by_itw(VectorView x, const Index &atmosphere_dim, ConstMatrixView x_surface, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, ConstMatrixView itw)
Interpolates a surface-type variable with pre-calculated weights by interp_atmsurface_gp2itw. 
Index nelem() const
Number of elements. 
Declarations having to do with the four output streams. 
void interp_atmfield_by_gp(VectorView x, const Index &atmosphere_dim, ConstTensor3View x_field, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Interpolates an atmospheric field given the grid positions. 
void gridpos_upperend_check(GridPos &gp, const Index &ie)
gridpos_upperend_check 
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate. 
void regrid_atmfield_by_gp(Tensor3 &field_new, const Index &atmosphere_dim, ConstTensor3View field_old, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Regrids an atmospheric field, for precalculated grid positions. 
void checksize_strict() const final
Strict consistency check. 
void p2gridpos(ArrayOfGridPos &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Numeric &extpolfac)
Calculates grid positions for pressure values. 
void get_gp_atmgrids_to_rq(ArrayOfGridPos &gp_p, ArrayOfGridPos &gp_lat, ArrayOfGridPos &gp_lon, const RetrievalQuantity &rq, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid)
Determines grid positions for regridding of atmospheric fields to retrieval grids. 
Index nrows() const
Returns the number of rows. 
void interp_atmsurface_by_gp(VectorView x, const Index &atmosphere_dim, ConstMatrixView x_surface, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Interpolates a surface-type variable given the grid positions. 
Index nelem() const
Returns the number of elements. 
Structure to store a grid position. 
Deals with internal derivatives, Jacobian definition, and OEM calculations. 
Index ncols() const
Returns the number of columns. 
void p2gridpos_poly(ArrayOfGridPosPoly &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Index order, const Numeric &extpolfac)
p2gridpos_poly 
Index ncols() const
Returns the number of columns. 
void interp_cloudfield_gp2itw(VectorView itw, GridPos &gp_p_out, GridPos &gp_lat_out, GridPos &gp_lon_out, const GridPos &gp_p_in, const GridPos &gp_lat_in, const GridPos &gp_lon_in, const Index &atmosphere_dim, const ArrayOfIndex &cloudbox_limits)
Converts atmospheric a grid position to weights for interpolation of a field defined ONLY inside the ...
void gridpos(ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac)
Set up a grid position Array. 
const Vector & get_numeric_grid(Index i) const
Get a numeric grid. 
void get_gp_rq_to_atmgrids(ArrayOfGridPos &gp_p, ArrayOfGridPos &gp_lat, ArrayOfGridPos &gp_lon, Index &n_p, Index &n_lat, Index &n_lon, const ArrayOfVector &ret_grids, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid)
Determines grid positions for regridding of atmospheric fields to retrieval grids. 
NUMERIC Numeric
The type to use for all floating point numbers. 
void jacobian_type_extrapol(ArrayOfGridPos &gp)
Adopts grid positions to extrapolation used for jacobians. 
void regrid_atmsurf_by_gp_oem(Matrix &field_new, const Index &atmosphere_dim, ConstMatrixView field_old, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Regridding of surface field OEM-type. 
void z_at_latlon(VectorView z, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, const GridPos &gp_lat, const GridPos &gp_lon)
Returns the geomtrical altitudes of p_grid for one latitude and one longitude. 
void z_at_lat_2d(VectorView z, ConstVectorView p_grid, ConstVectorView lat_grid, ConstMatrixView z_field, const GridPos &gp_lat)
Returns the geomtrical altitudes of p_grid for one latitude. 
void gridpos_poly(ArrayOfGridPosPoly &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Index order, const Numeric &extpolfac)
The maximum difference from 1 that we allow for a sum check. 
void gridpos_copy(GridPos &gp_new, const GridPos &gp_old)
gridpos_copy 
void interp_atmfield_gp2itw(Matrix &itw, const Index &atmosphere_dim, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Converts atmospheric grid positions to weights for interpolation of an atmospheric field...
Header file for special_interp.cc. 
void resize(Index p, Index r, Index c)
Resize function. 
void regrid_atmfield_by_gp_oem(Tensor3 &field_new, const Index &atmosphere_dim, ConstTensor3View field_old, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Regridding of atmospheric field OEM-type. 
Index npages() const
Returns the number of pages. 
This can be used to make arrays out of anything. 
void regrid_atmsurf_by_gp(Matrix &field_new, const Index &atmosphere_dim, ConstMatrixView field_old, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Regrids an atmospheric surface, for precalculated grid positions. 
void rte_pos2gridpos(GridPos &gp_p, GridPos &gp_lat, GridPos &gp_lon, const Index &atmosphere_dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstVectorView rte_pos)
Converts a geographical position (rte_pos) to grid positions for p, lat and lon. 
A constant view of a Tensor3. 
A constant view of a Vector. 
A constant view of a Matrix. 
void transform(VectorView y, double(&my_func)(double), ConstVectorView x)
A generic transform function for vectors, which can be used to implement mathematical functions opera...
void interp_atmsurface_gp2itw(Matrix &itw, const Index &atmosphere_dim, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Converts atmospheric grid positions to weights for interpolation of a surface-type variable...
void gridpos_1to1(ArrayOfGridPos &gp, ConstVectorView grid)
gridpos_1to1 
void complex_n_interp(MatrixView n_real, MatrixView n_imag, const GriddedField3 &complex_n, const String &varname, ConstVectorView f_grid, ConstVectorView t_grid)
General function for interpolating data of complex n type. 
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights. 
Index nrows() const
Returns the number of rows. 
void get_gp_atmsurf_to_rq(ArrayOfGridPos &gp_lat, ArrayOfGridPos &gp_lon, const RetrievalQuantity &rq, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid)
Determines grid positions for regridding of atmospheric surfaces to retrieval grids. 
void interp_atmfield_by_itw(VectorView x, const Index &atmosphere_dim, ConstTensor3View x_field, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, ConstMatrixView itw)
Interpolates an atmospheric field with pre-calculated weights by interp_atmfield_gp2itw. 
void itw2p(VectorView p_values, ConstVectorView p_grid, const ArrayOfGridPos &gp, ConstMatrixView itw)
Converts interpolation weights to pressures. 
void resize(Index r, Index c)
Resize function. 
void gp4length1grid(ArrayOfGridPos &gp)
Grid position matching a grid of length 1.