Differences between revisions 7 and 8
Revision 7 as of 2008-01-29 08:25:55
Size: 6487
Editor: NicoleThomas
Comment:
Revision 8 as of 2008-01-29 12:07:54
Size: 8509
Editor: NicoleThomas
Comment:
Deletions are marked like this. Additions are marked like this.
Line 102: Line 102:
=== Input files ===

==== CLaMS files used for interpolation (i3d.inp line 6) ====

Dimensions:
 * `NPARTS`
 * `NTHETAS` | `NZETAS`
 * `STRINGLEN` and `NRSPECS` (if all species from CLaMS file are interpolated)

Variables:
 * `SPECIES` (if all species from CLaMS file are interpolated)
 * `THETA_GRID` | `ZETA_GRID` and `THETA_DELTA` | `ZETA_DELTA`
 * `LAT(NPARTS)`
 * `LON (NPARTS)`
 * `THETA(NPARTS)`
 * `TIME_INIT(NPARTS)`
 * all specified species (dimension `NPARTS`)

Global Attributes:
 * `exp_POS_theta_min` | `exp_POS_zeta_min`
 * `exp_POS_theta_max` | `exp_POS_zeta_max`
 * `exp_POS_nthetas ` | `exp_POS_nzetas`
 * `exp_POS_lat_down`
 * `exp_POS_lat_up`
 * `exp_POS_r_coarse`
 * `exp_POS_r_high`




==== File with irregular grid (i3d.inp line 7) ====

If the global attribute ''platform'' is set to 'SATELLITE':

 * dimension time
 * dimension theta|zeta|press or alt
 * time(time)
 * theta(theta)|zeta(zeta)|press(press) or THETA|ZETA(time,alt)
 * NOONLAT(time,theta|zeta|press) or NOONLAT(time,alt)
 * NOONLON(time,theta|zeta|press) or NOONLON(time,alt)

If the global attribute ''platform'' is set to 'MODEL':
 * dimension time
 * dimension NPARTS
 * time(time)
 * LAT(time,NPARTS)
 * LON(time,NPARTS)
 * THETA|ZETA(time,NPARTS)


If the global attribute ''platform'' is set to 'AIRCRAFT' or it is missing:
 * dimension time or NPARTS
 * time(time) or TIME_INIT(NPARTS)
 * NOONLAT or LAT (time|NPARTS)
 * NOONLON or LON (time|NPARTS)
 * NOONTHETA|NOONZETA or THETA|ZETA (time|NPARTS)

Line 103: Line 161:

The output filenames consist of the filename specified in the configuration file ''i3d.inp'' (line 9), the date and the interpolation method:

  `filename`_`yymmddhh`_''nearest.nc'' (interpolation type 0)

  `filename`_`yymmddhh`_''weighted.nc'' (interpolation type 1)

  `filename`_`yymmddhh`_''weighted2.nc'' (interpolation type 3)


If interpolation method 2 is chosen, two output files per date are created (*_''nearest'' and *_''weighted'').

The package i3d

The program i3d.f90 can be used for interpolation of the CLaMS output (usually stored on irregular grid in init*.nc) on an arbitrary different irregular grid (e.g. experimental data). In particular, it can be applied for interpolation on a spatially highly resolved regular grid that, on the one side, does not destroy the fine structures in the spatial distributions calculated with CLaMS and, on the other side, makes easier the handling of the CLaMS output (e.g. plotting).

How to get the source code

The source code of this package is under control of the CVS (Concurrent Version System) utility. To get the source code the environment variable CVSROOT must be set to /usr/local/icg/icg1/archive. The command

cvs co -P i3d

creates a directory i3d in the current working directory and copies the current version of the i3d package to this directory.

The directory i3d includes the following subdirectories:

  • doc: latex file for documentation

  • mod: module files

  • obj: object files

  • source: source code

  • templates: templates for configuration file

Compiling

The program can be compiled on different platforms with the makefile stored in the directory i3d:

gmake i3d

The program will be compiled for the used platform and an executable i3d will be created.

Configuration file

The options for the execution of i3d are set in the configuration file i3d.inp:

1)  y            ! north_hemisphere (y/n)
2)  30., 90.     ! lat_min, lat_max
3)  3            ! 0=nearest, 1=weighted, 2=both, 3=weighted_new
4)  2        ! number of tags
    CH4 
    O3
5)  n                                          ! use one init-file
6)  /private/CNx_ECN_3d_24_1.5                 ! input directory (init-files)
    CNx                                        ! prefix of init-files (3 character)
7)  data/mipas_isen_noonpos_030103_030131.nc   ! input file (aircraft/satellite data)
8)  outdir                                     ! output directory
9)  testout                                    ! output prefix
10) y                                          ! write warnings  (y/n) 

1)  y            ! north_hemisphere (y/n)
2)  30., 90.     ! lat_min, lat_max
3)  3            ! 0=nearest, 1=weighted, 2=both, 3=weighted_new
4)  2            ! number of tags
    CH4 
    O3
5)  y                            ! use one init-file
6)  test1/init_BN0_02100112.nc   ! init-file
7)  test1/pos_A_0_01100112.nc    ! input file (aircraft/satellite data)
8)  test1                        ! output directory
9)  testout                      ! output prefix
10) n                            ! write warnings  (y/n)

Remarks:

  1. Start triangle for the walking triangle algorithm:

    y/n -- north/south hemisphere (does not work. Now, the n/2 (n-number of all triangles) is chosen as a start triangle).

  2. Latitude range of the (external) grid where interpolations have to be determined.
  3. Interpolation type (see below)
  4. Number of species and their names
  5. use one CLaMS file for all dates in input file (y/n)
  6. Name of CLaMS file (line 5: y)| directory with CLaMS output and prefix of these files (line 5: n)
  7. Input file with the external grid
  8. Output directory
  9. Name of the NetCDF output file (see below)
  10. Write warnings if triangle is not found

Interpolation type

The interpolation type is specified in the configuration file i3d.inp (line 3):

  • 0 - only one nearest neighbor from the CLaMS grid is used (i.e. this interpolation does not cause any numerical diffusion)
  • 1 - weighted interpolation over two triangles (i.e. 6 neighbors) the contribution of this 6 points depends on the horizontal distance within the upper and lower triangle as well as on the absolute vertical differences of these 6 points to the considered air parcel, i.e. APs with smallest r-values have the higher contribution where r is defined as

    • r = |\theta_{exp}-\theta|r_s, \quad r_s^2=(x_{exp}-x)^2+(y_{exp}-y)^2+(z_{exp}-z)^2

    Here, index exp denotes the coordinates of a given AP where the interpolation from the external (CLaMS) grid should be determined. \theta_{exp}-\theta and r_h are the distances in the \theta-space (absolute difference in \zeta-space) and on the unit sphere (i.e., points are on a unit sphere but the distance is defined in R^3), respectively.

  • 2 - Interpolation type 0 and 1 (two output files per date are created)
  • 3 - weighted interpolation over two triangles (i.e. 6 neighbors) the contribution of this 6 points depends on the horizontal distance within the upper and lower triangle as well as on the absolute vertical differences of these 6 points to the considered air parcel, i.e. APs with smallest r-values have the higher contribution where r is defined as

    r = \sqrt{(x_{exp}-x)^2+(y_{exp}-y)^2+(z_{exp}-z)^2+((theta_{exp}-theta)/delta_{theta}ratio)^2)}

Input files

CLaMS files used for interpolation (i3d.inp line 6)

Dimensions:

  • NPARTS

  • NTHETAS | NZETAS

  • STRINGLEN and NRSPECS (if all species from CLaMS file are interpolated)

Variables:

  • SPECIES (if all species from CLaMS file are interpolated)

  • THETA_GRID | ZETA_GRID and THETA_DELTA | ZETA_DELTA

  • LAT(NPARTS)

  • LON (NPARTS)

  • THETA(NPARTS)

  • TIME_INIT(NPARTS)

  • all specified species (dimension NPARTS)

Global Attributes:

  • exp_POS_theta_min | exp_POS_zeta_min

  • exp_POS_theta_max | exp_POS_zeta_max

  • exp_POS_nthetas  | exp_POS_nzetas

  • exp_POS_lat_down

  • exp_POS_lat_up

  • exp_POS_r_coarse

  • exp_POS_r_high

File with irregular grid (i3d.inp line 7)

If the global attribute platform is set to 'SATELLITE':

  • dimension time
  • dimension theta|zeta|press or alt
  • time(time)
  • theta(theta)|zeta(zeta)|press(press) or THETA|ZETA(time,alt)
  • NOONLAT(time,theta|zeta|press) or NOONLAT(time,alt)
  • NOONLON(time,theta|zeta|press) or NOONLON(time,alt)

If the global attribute platform is set to 'MODEL':

  • dimension time
  • dimension NPARTS
  • time(time)
  • LAT(time,NPARTS)
  • LON(time,NPARTS)
  • THETA|ZETA(time,NPARTS)

If the global attribute platform is set to 'AIRCRAFT' or it is missing:

  • dimension time or NPARTS
  • time(time) or TIME_INIT(NPARTS)
  • NOONLAT or LAT (time|NPARTS)
  • NOONLON or LON (time|NPARTS)
  • NOONTHETA|NOONZETA or THETA|ZETA (time|NPARTS)

Output files

The output filenames consist of the filename specified in the configuration file i3d.inp (line 9), the date and the interpolation method:

  • filename_yymmddhh_nearest.nc (interpolation type 0)

    filename_yymmddhh_weighted.nc (interpolation type 1)

    filename_yymmddhh_weighted2.nc (interpolation type 3)

If interpolation method 2 is chosen, two output files per date are created (*_nearest and *_weighted).

The walking triangle algorithm

The walking triangle algorithm is described in [1]. It describes how in 2D (and 3D) a Delaunay triangle can be found that contains a given point X. The walking triangle uses the following criterion to find such a triangle:

X is inside of a triangle ABC if the given point X and the triangle point that does not define the considered triangle side are are on the same side of the considered triangle side for each of the 3 possible sides of the triangle.

E.g. for the side AB, the following relation has to be valid:

  • [{\bf n}\cdot({\bf c}-{\bf a})][{\bf n}\cdot({\bf x}-{\bf a})] > 0

with {\bf n}={\bf a}\times {\bf b}. This means that X and C are on the same side of AB if both scalar products have the same sign.

The walking triangle algorithm checks if X is inside of the the start triangle by applying criterion for each triangle side. If for one triangle side this criterion is not valid, one has to walk to the corresponding neighboring triangle. In this way one walks in this triangle world directly to the triangle containing X.

References

[1] M. Sambridge, J. Braun, and H. McQueen. Geophysical parameterization and interpolation of irregular data using natural neighbors. Geophys. J. Int., 122:837--857, 1995.

i3d (last edited 2019-07-31 12:30:31 by NicoleThomas)