ARTS  2.3.1285(git:92a29ea9-dirty)
special_interp.h
Go to the documentation of this file.
1 /* Copyright (C) 2002-2012 Patrick Eriksson <Patrick.Eriksson@chalmers.se>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
26 #ifndef special_interp_h
27 #define special_interp_h
28 
29 #include "gridded_fields.h"
30 #include "interpolation.h"
31 #include "interpolation_poly.h"
32 #include "jacobian.h"
33 
34 /*===========================================================================
35  === Interpolation functions for atmospheric grids, fields and surfaces
36  ===========================================================================*/
37 
59  const Index& atmosphere_dim,
60  const ArrayOfGridPos& gp_p,
61  const ArrayOfGridPos& gp_lat,
62  const ArrayOfGridPos& gp_lon);
63 
90  const Index& atmosphere_dim,
91  ConstTensor3View x_field,
92  const ArrayOfGridPos& gp_p,
93  const ArrayOfGridPos& gp_lat,
94  const ArrayOfGridPos& gp_lon,
95  ConstMatrixView itw);
96 
122  const Index& atmosphere_dim,
123  ConstTensor3View x_field,
124  const ArrayOfGridPos& gp_p,
125  const ArrayOfGridPos& gp_lat,
126  const ArrayOfGridPos& gp_lon);
127 
153 Numeric interp_atmfield_by_gp(const Index& atmosphere_dim,
154  ConstTensor3View x_field,
155  const GridPos& gp_p = {0, {0, 1}},
156  const GridPos& gp_lat = {0, {0, 1}},
157  const GridPos& gp_lon = {0, {0, 1}});
158 
187  GridPos& gp_p_out,
188  GridPos& gp_lat_out,
189  GridPos& gp_lon_out,
190  const GridPos& gp_p_in,
191  const GridPos& gp_lat_in,
192  const GridPos& gp_lon_in,
193  const Index& atmosphere_dim,
194  const ArrayOfIndex& cloudbox_limits);
195 
216  const Index& atmosphere_dim,
217  const ArrayOfGridPos& gp_lat,
218  const ArrayOfGridPos& gp_lon);
219 
245  const Index& atmosphere_dim,
246  ConstMatrixView x_surface,
247  const ArrayOfGridPos& gp_lat,
248  const ArrayOfGridPos& gp_lon,
249  ConstMatrixView itw);
250 
275  const Index& atmosphere_dim,
276  ConstMatrixView x_field,
277  const ArrayOfGridPos& gp_lat,
278  const ArrayOfGridPos& gp_lon);
279 
304 Numeric interp_atmsurface_by_gp(const Index& atmosphere_dim,
305  ConstMatrixView x_field,
306  const GridPos& gp_lat,
307  const GridPos& gp_lon);
308 
324 void regrid_atmfield_by_gp(Tensor3& field_new,
325  const Index& atmosphere_dim,
326  ConstTensor3View field_old,
327  const ArrayOfGridPos& gp_p,
328  const ArrayOfGridPos& gp_lat,
329  const ArrayOfGridPos& gp_lon);
330 
345 void regrid_atmsurf_by_gp(Matrix& field_new,
346  const Index& atmosphere_dim,
347  ConstMatrixView field_old,
348  const ArrayOfGridPos& gp_lat,
349  const ArrayOfGridPos& gp_lon);
350 
372  ArrayOfGridPos& gp_lat,
373  ArrayOfGridPos& gp_lon,
374  const RetrievalQuantity& rq,
375  const Index& atmosphere_dim,
376  const Vector& p_grid,
377  const Vector& lat_grid,
378  const Vector& lon_grid);
379 
399  ArrayOfGridPos& gp_lon,
400  const RetrievalQuantity& rq,
401  const Index& atmosphere_dim,
402  const Vector& lat_grid,
403  const Vector& lon_grid);
404 
405 
434  ArrayOfGridPos& gp_lat,
435  ArrayOfGridPos& gp_lon,
436  Index& n_p,
437  Index& n_lat,
438  Index& n_lon,
439  const ArrayOfVector& ret_grids,
440  const Index& atmosphere_dim,
441  const Vector& p_grid,
442  const Vector& lat_grid,
443  const Vector& lon_grid);
444 
470  ArrayOfGridPos& gp_lon,
471  Index& n_lat,
472  Index& n_lon,
473  const ArrayOfVector& ret_grids,
474  const Index& atmosphere_dim,
475  const Vector& lat_grid,
476  const Vector& lon_grid);
477 
478 
494 void regrid_atmfield_by_gp_oem(Tensor3& field_new,
495  const Index& atmosphere_dim,
496  ConstTensor3View field_old,
497  const ArrayOfGridPos& gp_p,
498  const ArrayOfGridPos& gp_lat,
499  const ArrayOfGridPos& gp_lon);
500 
515 void regrid_atmsurf_by_gp_oem(Matrix& field_new,
516  const Index& atmosphere_dim,
517  ConstMatrixView field_old,
518  const ArrayOfGridPos& gp_lat,
519  const ArrayOfGridPos& gp_lon);
520 
541 void itw2p(VectorView p_values,
542  ConstVectorView p_grid,
543  const ArrayOfGridPos& gp,
544  ConstMatrixView itw);
545 
570 void p2gridpos(ArrayOfGridPos& gp,
571  ConstVectorView old_pgrid,
572  ConstVectorView new_pgrid,
573  const Numeric& extpolfac = 0.5);
574 
594  ConstVectorView old_pgrid,
595  ConstVectorView new_pgrid,
596  const Index order,
597  const Numeric& extpolfac = 0.5);
598 
624 void rte_pos2gridpos(GridPos& gp_p,
625  GridPos& gp_lat,
626  GridPos& gp_lon,
627  const Index& atmosphere_dim,
628  ConstVectorView p_grid,
629  ConstVectorView lat_grid,
630  ConstVectorView lon_grid,
631  ConstTensor3View z_field,
632  ConstVectorView rte_pos);
633 
652 void rte_pos2gridpos(GridPos& gp_lat,
653  GridPos& gp_lon,
654  const Index& atmosphere_dim,
655  ConstVectorView lat_grid,
656  ConstVectorView lon_grid,
657  ConstVectorView rte_pos);
658 
675 void z_at_lat_2d(VectorView z,
676  ConstVectorView p_grid,
677  ConstVectorView lat_grid,
678  ConstMatrixView z_field,
679  const GridPos& gp_lat);
680 
699 void z_at_latlon(VectorView z,
700  ConstVectorView p_grid,
701  ConstVectorView lat_grid,
702  ConstVectorView lon_grid,
703  ConstTensor3View z_field,
704  const GridPos& gp_lat,
705  const GridPos& gp_lon);
706 
721 void complex_n_interp(MatrixView n_real,
722  MatrixView n_imag,
723  const GriddedField3& complex_n,
724  const String& varname,
725  ConstVectorView f_grid,
726  ConstVectorView t_grid);
727 
728 #endif // special_interp_h
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
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.
The VectorView class.
Definition: matpackI.h:610
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 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.
Routines for setting up the jacobian.
The Vector class.
Definition: matpackI.h:860
The MatrixView class.
Definition: matpackI.h:1093
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 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 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 ...
Header file for interpolation.cc.
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...
Structure to store a grid position.
Definition: interpolation.h:73
Deals with internal derivatives, Jacobian definition, and OEM calculations.
Definition: jacobian.h:120
The Tensor3 class.
Definition: matpackIII.h:339
void p2gridpos(ArrayOfGridPos &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Numeric &extpolfac=0.5)
Calculates grid positions for pressure values.
void interp_atmsurface_by_gp(VectorView x, const Index &atmosphere_dim, ConstMatrixView x_field, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Interpolates a surface-type variable given the grid positions.
void p2gridpos_poly(ArrayOfGridPosPoly &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Index order, const Numeric &extpolfac=0.5)
p2gridpos_poly
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 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.
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.
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
The Matrix class.
Definition: matpackI.h:1193
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.
This can be used to make arrays out of anything.
Definition: array.h:40
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.
Header file for interpolation_poly.cc.
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 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 itw2p(VectorView p_values, ConstVectorView p_grid, const ArrayOfGridPos &gp, ConstMatrixView itw)
Converts interpolation weights to pressures.
A constant view of a Tensor3.
Definition: matpackIII.h:132
A constant view of a Vector.
Definition: matpackI.h:476
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.
A constant view of a Matrix.
Definition: matpackI.h:982
Implementation of gridded fields.
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 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.