Go to the documentation of this file.
88 assert(gp_lat.
nelem() == n);
94 assert(gp_lat.
nelem() == n);
95 assert(gp_lon.
nelem() == n);
108 assert(
x.nelem() == gp_p.
nelem());
111 assert(itw.
ncols() == 2);
116 assert(itw.
ncols() == 4);
121 assert(itw.
ncols() == 8);
122 interp(
x, itw, x_field, gp_p, gp_lat, gp_lon);
179 assert(itw.
nelem() == 2);
188 assert(itw.
nelem() == 4);
200 assert(itw.
nelem() == 8);
241 assert(n == gp_lon.
nelem());
254 assert(itw.
ncols() == 1);
259 assert(
x.nelem() == gp_lat.
nelem());
260 assert(itw.
ncols() == 2);
265 assert(
x.nelem() == gp_lat.
nelem());
266 assert(itw.
ncols() == 4);
267 interp(
x, itw, x_surface, gp_lat, gp_lon);
319 field_new.
resize(n1, 1, 1);
325 field_new.
resize(n1, n2, 1);
336 field_new.
resize(n1, n2, n3);
339 interp(field_new, itw, field_old, gp_p, gp_lat, gp_lon);
349 field_new = field_old;
362 interp(field_new, itw, field_old, gp_lat, gp_lon);
426 const Numeric inf_proxy = 1.0e99;
428 gp_p.resize(
p_grid.nelem());
429 n_p = ret_grids[0].
nelem();
439 n_lat = ret_grids[1].
nelem();
453 n_lon = ret_grids[2].
nelem();
476 const Numeric inf_proxy = 1.0e99;
480 n_lat = ret_grids[0].
nelem();
494 n_lon = ret_grids[1].
nelem();
515 const bool np_is1 = field_old.
npages() == 1 ? true :
false;
516 const bool nlat_is1 =
518 const bool nlon_is1 =
522 if (!np_is1 && !nlat_is1 && !nlon_is1) {
528 field_new.
resize(n1, 1, 1);
529 field_new(
joker, 0, 0) = field_old(0, 0, 0);
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;
558 assert(gp_lat[
lat].fd[0] < 1e-6);
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);
586 assert(gp_lat[
lat].fd[0] < 1e-6);
596 for (
Index p = 0; p < n1; p++) {
597 assert(gp_p[p].fd[0] < 1e-6);
599 assert(gp_lon[
lon].fd[0] < 1e-6);
609 for (
Index p = 0; p < n1; p++) {
610 assert(gp_p[p].fd[0] < 1e-6);
618 if (nlat_is1 && nlon_is1)
625 assert(gp_lat[
lat].fd[0] < 1e-6);
627 assert(gp_lon[
lon].fd[0] < 1e-6);
638 assert(gp_lat[
lat].fd[0] < 1e-6);
648 assert(gp_lon[
lon].fd[0] < 1e-6);
665 field_new = field_old;
667 const bool nlat_is1 = field_old.
nrows() == 1 ? true :
false;
668 const bool nlon_is1 =
672 if (!nlat_is1 && !nlon_is1) {
679 field_new(
joker, 0) = field_old(0, 0);
685 if (nlat_is1 && nlon_is1)
695 assert(gp_lon[
lon].fd[0] < 1e-6);
705 assert(gp_lat[
lat].fd[0] < 1e-6);
722 assert(itw.
ncols() == 2);
730 interp(p_values, itw, logpgrid, gp);
770 gridpos(gp, logold, lognew, extpolfac);
815 for (
Index i = 0; i < np; i++) {
825 for (
Index i = 0; i < np; i++) {
872 assert(z.
nelem() == np);
903 assert(z.
nelem() == np);
904 assert(
z_field.npages() == np);
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++) {
981 for (
Index i = 0; i < nt_in; i++) {
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++) {
void gridpos_1to1(ArrayOfGridPos &gp, ConstVectorView grid)
gridpos_1to1
Index atmosphere_dim(Workspace &ws) noexcept
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_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.
Tensor3 z_field(Workspace &ws) noexcept
Numeric lat(Workspace &ws) noexcept
void gridpos_copy(GridPos &gp_new, const GridPos &gp_old)
gridpos_copy
const ArrayOfVector & Grids() const
Returns the grids of the retrieval.
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 gridpos(ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac)
Set up a grid position Array.
void itw2p(VectorView p_values, ConstVectorView p_grid, const ArrayOfGridPos &gp, ConstMatrixView itw)
Converts interpolation weights to pressures.
void p2gridpos(ArrayOfGridPos &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Numeric &extpolfac)
Calculates grid positions for pressure values.
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 jacobian_type_extrapol(ArrayOfGridPos &gp)
Adopts grid positions to extrapolation used for jacobians.
Vector lat_grid(Workspace &ws) noexcept
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
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 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 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.
ArrayOfIndex cloudbox_limits(Workspace &ws) noexcept
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.
Index nrows() const
Returns the number of rows.
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 resize(Index p, Index r, Index c)
Resize function.
Numeric lon(Workspace &ws) noexcept
Index npages() const
Returns the number of pages.
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 checksize_strict() const final
Strict consistency check.
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.
This can be used to make arrays out of anything.
const Vector & get_numeric_grid(Index i) const
Get a numeric grid.
Declarations having to do with the four output streams.
Vector rte_pos(Workspace &ws) noexcept
void gridpos_upperend_check(GridPos &gp, const Index &ie)
gridpos_upperend_check
Index ncols() const
Returns the number of columns.
Index nelem() const
Returns the number of elements.
Vector p_grid(Workspace &ws) noexcept
NUMERIC Numeric
The type to use for all floating point numbers.
Vector f_grid(Workspace &ws) noexcept
void resize(Index r, Index c)
Resize function.
Index nrows() const
Returns the number of rows.
Vector lon_grid(Workspace &ws) noexcept
A constant view of a Matrix.
Structure to store a grid position.
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.
void gp4length1grid(ArrayOfGridPos &gp)
Grid position matching a grid of length 1.
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.
Index ncols() const
Returns the number of columns.
A constant view of a Tensor3.
Header file for special_interp.cc.
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.
Vector x(Workspace &ws) noexcept
void p2gridpos_poly(ArrayOfGridPosPoly &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Index order, const Numeric &extpolfac)
p2gridpos_poly
INDEX Index
The type to use for all integer numbers and indices.
Deals with internal derivatives, Jacobian definition, and OEM calculations.
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.
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.
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 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_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 ...
A constant view of a Vector.
Index nelem() const
Number of elements.
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
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.