MVLib - Short Writeup - Version 4.0
Interpolation and conversion routines - Last update April, 28 2011
Source code available for local users only.
In the second column of the following table, S stays for "Subroutine", I stays for "Integer function" and R stays for "Real function".
zenith I Description.
sinphi I Description.
latlonrange(clat,clon,
latmin,latmax,lonmin,lonmax)
I latlonrange gives as output 1 if clat is within the range between latmin and latmax and clon is within the range between lonmin and lonmax; otherwise 0 is returned. All the input parameter are real values.
indexrange(n,n1,n2) L indexrange is a logical function returning .true. if the integer n is within the range between n1 and n2.
distance(xlat1,xlon1,xlat2,xlon2) R Gives the distance (meters) between the two points of coordinate (xlat1,xlon1) and (xlat2,xlon2). In order to avoid division by zero, the distance is always assumed not lower than 0.1 meters.
finterp(field,lat,lon,ix,jx,xlat,xlon) R Returns the interpolated value of array field in the point of coordinate (xlat,xlon). The grid is defined by the two arrays lat and lon. The integer variables ix and jx specify the dimension of field, lat and lon arrays. The first dimension is the longitude. Program is stopped if the point specified by xlat and xlon is outside the domain specified by lat andlon arrays.
ginterp(field,lat,lon,ix,jx,xlat,xlon) R Similar to finterp, the input/output arguments are the same, but in this case the first index of each arrays is the latitudes, this routine allows to directly interpolate the MM5 2-dimensional fields. Another important difference is that this routine allows to interpolate not considering the sea grid points; to this aim it it is needed to correctly set the value of "Check Landuse" and "Dominio" MVLib flags.
closest (field,lat,lon,ix,jx,xlat,xlon) R Similar to ginterp, the input/output arguments are the same, but in this case is not carried out an interpolation, but the value in the closest grid point is returned.
grinterp(fld1,xlat1,xlon1,ix1,jx1,
fld2,xlat2,xlon2,ix2,jx2)
S Interpolate the field fld1 defined on the grid specified by the arrays xlat1 and xlon1, on the grid specified by the arrays xlat2 and xlon2. Results are given in the vector fld2. The arrays fld1, xlat1 and xlon1 are dimensioned (ix1,jx1), the arrays fld2, xlat2 and xlon2 are dimensioned (ix2,jx2). If the MVLib flag Indice LatLon is set to 0 (default), the grinterp assumes that the first index of the arrays is the longitude, otherwise the first index is the latitude; as a consequence if you are manipulating MM5 model fields you must set that flag with a value different from zero. Program is stopped if a point specified by the arrays xlat2 and xlon2 is outside the domain specified by xlat1 and xlon1. The use of this routine is shown in the examples 11 and 12.
chymdownscaling S chymdownscaling is documented in the CHyM library section
cressman(val,clat,clon,nc,
rdfl,rad, mat,lat,lon,ix,jx)
S cressman utility allows to rebuild a field on a regular grid from sparse data. The output array is mat and the arrays lat and lon specify the latitude and longitude grid respectively. The nc elements of vector val contain the observed data, while the vectors clat and clon contain, as input, the corresponding latitudes and longitudes. The (i,j) element of array mat is calculated following:
and the weight W are calculated following:
being a the radius of influence specified in Km by the real input variable rad. The integer input variable rdfl is not yet used.
Conversion routines
utm2latlon(x,y,xlat,xlon) S Description.
latlon2utm(xlat,xlon,x,y) S Description.
sess2centi(gradi,primi,secondi) R Converts from sexagesimal to centigrade. Arguments are integer.
centi2fahrenheit(deg) R Convert the temperature passed as argument from centigrade to fahrenheit degree.
fahrenheit2centi(deg) R Convert the temperature passed as argument from fahrenheit to centigrade degree.
deg2rad(alpha) R Convert the angle passed as argument from degree to radiant.
rad2deg(alpha) R Convert the angle passed as argument from radiant to degree.
winddirection(ux,vx) R Calculate the wind direction as the angle respect to the east direction. The input argument are two real variables specifying the zonal and meridional component respectively.
kelvin2centi(t,ixm,jxm,kxm) S Convert from Kelvin degree to centigrade the whole array t dimensioned (ixm,jxm,kxm).
(may be) Obselete routines
indextm(gph,xlon,xlat,nlon,nlat) I Calculate Tibaldi-Molteni block index.
ermejopunto(rlat,rlon,good,
nlat,nlon, slat,slon,nsat,i,j,icode)
S Description