libsim
Versione 7.1.9
|
Libsim allows to perform different space transformations on gridded and sparse point datasets; transformations are available both at the level of API library calls and within the command line utilities such as vg6d_subarea, vg6d_transform, vg6d_getpoint, and v7d_transform.
Transformations are defined at least by 2 parameters named trans_type and subtype. The transformations operate separately either on the vertical or on the horizontal structure of the coordinate system. Horizontal tranformations are divided into two main groups: transformations conserving the input point structure and transformations to an arbitrary grid or set of sparse points. Vertical transformations are just vertical transformations for the moment.
These transformations are grid-to-grid or sparse points-to-grid; the output geographic projection or grid point coordinates is the same as the input, and only a few parameters have to be specified.
It is a grid-to-grid transformation, it generates a new grid by cutting or extending (with missing values) the input grid, adding or removing points on the four sides, without changing the geographical reference system:
It is a grid-to-grid transformation, it generates a new grid in which the value at every point is the result of a function computed over npx X npy points of the original grid, without changing the geographical reference system:
When the metamorphosis transformation type is applied, the output points and values are the same as the input ones, but the data structure is changed from grid to sparse points, so it is only a grid-to-sparse points transformation:
These transformations produce, in output, data on an arbitrary grid or set of sparse points, thus a full description of the output grid or a list of output points have to be provided.
This transformation interpolates the input data on a new set of points, the input and output datasets can be either of grid type or of sparse data type, but not all the combinations make sense for all the subtypes:
The boxinter type is suitable both for grid-to-grid and sparse points-to-grid transformations and it computes data on a new grid in which the value at every point is the result of a function computed over those input points that lie inside the output point's grid box:
The polyinter type is suitable both for grid-to-sparse points and sparse points-to-sparse points transformations and it computes data on a new set of points in which the value at every point is the result of a function computed over those input points that lie inside an arbitrary georoferenced polygon; the output point coordinates are defined as the centroids of the polygons:
Vertical interpolations are selected with trans_type='vertint'. The sub_types available are 'linear'
, more suitable for gridded data, and 'linearsparse'
for sparse data, where every vertical profile has its own independent set of vertical levels. Apart from sub_type, all the other concepts apply almost in the same way to vertical interpolations in sparse point space or in grid point space.
Vertical interpolations require the specification of the following information:
Vertical levels and layers are specified in analogy with grib2 coding by means of one or two surfaces with type of coordinate specified as in the following table:
level code | type of level and unit | associated variable and unit |
---|---|---|
20 | isothermal level (K) | B12101 (K) |
100 | isobaric level (Pa) | B10004 (Pa) |
102 | height over sea level (mm) | B10007 (m) |
103 | height over surface (mm) | B10007 (m) + surface orography |
104 | sigma level (nondimensional) | - |
105 | hybrid level (nondimensional) | - |
106 | depth below land surface (mm) | - |
107 | isentropical (K) | B12192 (K) |
108 | level at specified pressure difference from ground to level (Pa) | - |
Only the vertical levels having an associated B table variable are fully supported as output target level of vertical interpolations in libsim, the other ones are only supported as input levels for vertical interpolations or for transformations between the same type of vertical coordinates.
Layers are managed only when the type of top and bottom surfaces are the same and they are treated as a single level whose vertical coordinate is the average (or log-average for pressure) between the value of the coordinate at the top and at the bottom of the layer.
In the case of vertical interpolation from command line tools, the command-line arguments specifying the information indicated above are the following:
--trans-level-type=it
,ib,ot,ob where it
specifies the input level or top surface type, ot
specifies the input bottom surface type for a layer (it should be empty for a level), and similar for ot
and ob
--trans-level-list=
while the bottom surfaces of layers, if applicable, are specified by –trans-botlevel-list
. In both cases the values have to be specified as comma-separated lists of integer values in the units indicated in the second column of the table above--coord-file
and --coord-format
. It must have the same horizontal structure of the main dataset, it must contain a single time, timerange, network, it must match exactly the vertical level structure of the input data to be interpolated (extra level types are however ignored without error) and it must contain a variable that matches the one in the third column of the previous table (possibly after an automatic grib-to-bufr conversion).This is a simple special case, where there is no need to specify the vertical output coordinate in the input system, but only the list of output levels. The following example shows hot to interpolate data on isobaric surfaces to a different set of isobaric surfaces:
Notice that vertical interpolations where pressure is the vertical coordinate are computed linearly in the logarithm of pressure.
It is also possible to interpolate from layers between two levels of equal type to levels and vice-versa, with the simplification that the coordinate associated to a layer is the average of the coordinates of the levels above and below (log-average for pressure levels).
In the case of hybrid levels, where the vertical coordinate is an integer index, the list of output levels can be automatically generated if not provided. This example shows how to extract vertical coordinate information from COSMO model output for interpolating data on native model level/layers:
When the vertical coordinate system is different in input and in output, the coordinates of each input point in terms of the output coordinate system has to be specified.
This can be done either through an external coordinate file or by taking the coordinate from the input dataset. The first case is suitable when output coordinates expressed in the input coordinate system are constant in time, while the second is suitable for output coordinates that vary with time. In both cases, the variable expressing the coordinate value must be defined on the same input levels as the data to be interpolated and must have a parameter matching the one in the table above.
The following example shows how to interpolate gridded data from input hybrid coordinate system (code 105) to height system (code 102) by externally providing the coordinate of all the input levels in the output coordinate system (height):
If height over surface (103) is desired instead of height over sea level, then 102
has to be replaced with 103
and the coordinate files containing also surface orography hyblevcoord_surf.grib
and hyblaycoord_surf.grib
produced in the previous example shoud be used in place of hyblevcoord.grib
and hyblaycoord.grib
.
The following example shows how to interpolate gridded data from input hybrid coordinate system to pressure system, assuming that the time-varying pressure field on the input model layers is included in the input dataset:
For completeness, also the pressure field in this case will be contained in the output file although it will be constant within numerical precision on the output levels.
When vertically interpolating observed radiosoundings, usually intepreted as isobaric levels, the preliminary computation of height variable B10007 from geopotential may be necessary, thus the complete procedure will look like the following: