tools_sub Module

Module for rearrangement of the radial grid and some operations for undef data in tools/ programs


Derived Types

type, public ::  file_ord_3d

Setting variable order in read/write file

Components

Type Visibility Attributes Name Initial
integer, public :: VT
integer, public :: VR
integer, public :: VTs
integer, public :: VTc
integer, public :: VRs
integer, public :: VRc
integer, public :: phi
integer, public :: phis
integer, public :: phic
integer, public :: zeta
integer, public :: zetas
integer, public :: zetac

Functions

public function check_data_fulfill(val, undef, nt_count, dir, ncount)

Check the innermost radius of data with no undef If the innermost radius has not been found, the value of zero is returned.

Arguments

Type IntentOptional Attributes Name
double precision, intent(in) :: val(:,:)

original data

double precision, intent(in) :: undef

missing value

integer, intent(in), optional :: nt_count

minimum of data gridpoints default = size(val,2)

character(len=3), intent(in), optional :: dir

direction for searching 'i2o': inner to outer radii (default) 'o2i': outer to inner radii

integer, intent(out), optional :: ncount

available sampling number

Return Value integer

public function inner_radius_check(nrin, nrout, radi)

Check positive value of the innermost radius. If the innermost radius is negative, the element number located at the innermost positive radius is returned.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nrin

A given element of the innermost radius

integer, intent(in) :: nrout

A given element of the outermost radius

double precision, intent(in) :: radi(nrin:nrout)

Original radial grids

Return Value integer


Subroutines

public subroutine replace_val_2d(ival2d, orgval, repval)

replace orgval with repval in ival2d array

Arguments

Type IntentOptional Attributes Name
double precision, intent(inout) :: ival2d(:,:)

base

double precision, intent(in) :: orgval

replace from this

double precision, intent(in) :: repval

replace to this

public subroutine replace_undef(ioval2d, undeflag, undefv)

replace ioval2d with undefv at the point undeflag == .true.

Arguments

Type IntentOptional Attributes Name
double precision, intent(inout) :: ioval2d(:,:)

base

logical, intent(in) :: undeflag(size(ioval2d,1),size(ioval2d,2))

flag for undefined point

double precision, intent(in) :: undefv

undefined value

public subroutine proj_Vs(xcent, ycent, xx, yy, ux, vy, projV, undef)

projection of a uniform wind [(ux,vy) on Cartesian grids] to the line-of-sight component along the radar beam

Arguments

Type IntentOptional Attributes Name
double precision, intent(in) :: xcent

Radar location (x or lon)

double precision, intent(in) :: ycent

Radar location (y or lat)

double precision, intent(in) :: xx(:,:)

x coordinate (x or lon)

double precision, intent(in) :: yy(size(xx,1),size(xx,2))

y coordinate (y or lat)

double precision, intent(in) :: ux

X component of the uniform wind (m/s)

double precision, intent(in) :: vy

Y component of the uniform wind (m/s)

double precision, intent(out) :: projV(size(xx,1),size(xx,2))

line-of-sight component on (xx,yy)

double precision, intent(in) :: undef

undefined value

public subroutine proj_rtVs(radi, thet, ux, vy, projVR, projVT, undef)

projection of a uniform wind [(ux,vy) on Cartesian grids] to the radial and tangential components on the polar coordinate

Arguments

Type IntentOptional Attributes Name
double precision, intent(in) :: radi(:)

radial grid (m)

double precision, intent(in) :: thet(:)

azimuthal grid (rad)

double precision, intent(in) :: ux

X-component of a uniform wind (m/s)

double precision, intent(in) :: vy

Y-component of a uniform wind (m/s)

double precision, intent(out) :: projVR(size(radi),size(thet))

radial wind

double precision, intent(out) :: projVT(size(radi),size(thet))

tangential wind

double precision, intent(in) :: undef

undefined value

public subroutine decomp_Vd2rdpn(Vd, thetad, u_decomp, v_decomp, undef)

decomposition of VD to the components parallel and normal to the direction of thetad = 0

Arguments

Type IntentOptional Attributes Name
double precision, intent(in) :: Vd(:,:)

Doppler velocity (m/s)

double precision, intent(in) :: thetad(size(Vd,1),size(Vd,2))

azimuthal angle from the line of radar to TC center (rad)

double precision, intent(out) :: u_decomp(size(Vd,1),size(Vd,2))

parallel component

double precision, intent(out) :: v_decomp(size(Vd,1),size(Vd,2))

normal component

double precision, intent(in) :: undef

undefined value

public subroutine rearrange_undef_rad(skip_thres, nr_in, nr_out_org, nt, undef_grid, r_org, rh_org, thetad_org, Vra_org, nr_out, nn_grid, r, rh, thetad, Vra)

rearrange the radial grids: 1. skip radii with few azimuthal sampling (less than "skip_thres") 2. rearrange the radial coordinate. [Note1]: r, rh, thetad, and Vra must be given by the same as the array number in the original. (that is, size(r_org) == size(r).) [Note2]: nr_out_org >= nr_out. Undef value is given in r, rh, thetad, and Vra outside nr_out.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: skip_thres

threshold for unused radius

integer, intent(in) :: nr_in

innermost array number in radius

integer, intent(in) :: nr_out_org

outermost array number in radius (orig)

integer, intent(in) :: nt

azimuthal array number

logical, intent(in), dimension(nr_in:nr_out_org,1:nt) :: undef_grid

flag of undefined grid (.true. is undef)

double precision, intent(in), dimension(nr_in:nr_out_org) :: r_org

velocity radius (original) [m]

double precision, intent(in), dimension(nr_in:nr_out_org+1) :: rh_org

potential radius (original) [m]

double precision, intent(in), dimension(nr_in:nr_out_org,1:nt) :: thetad_org

azimuthal angle from radar (original) [rad]

double precision, intent(in), dimension(nr_in:nr_out_org,1:nt) :: Vra_org

Doppler velocity (original) [m/s]

integer, intent(out) :: nr_out

outermost array number in radius (skip)

integer, intent(out), dimension(nr_in:nr_out_org) :: nn_grid

grid number in rearranged each radius

double precision, intent(out), dimension(nr_in:nr_out_org) :: r

velocity radius (skip) [m]

double precision, intent(out), dimension(nr_in:nr_out_org+1) :: rh

potential radius (skip) [m]

double precision, intent(out), dimension(nr_in:nr_out_org,1:nt) :: thetad

azimuthal angle from radar (skip) [rad]

double precision, intent(out), dimension(nr_in:nr_out_org,1:nt) :: Vra

Doppler velocity (skip) [m/s]

public subroutine recover_undef_rad(nrotmin, nrot, ndivmin, ndiv, nr_in, nr_out, nr_out_org, nt, undef, undef_grid, nn_grid, VTtot_rt_t, VRtot_rt_t, VRT0_rt_t, VDR0_rt_t, VRTn_rt_t, VRRn_rt_t, VDTm_rt_t, VDRm_rt_t, VRT0_GVTD_rt_t, VDR0_GVTD_rt_t, VRTns_r, VRTnc_r, VRRns_r, VRRnc_r, Vn_0_rt_t, phin_rt_t, zetan_rt_t, zetans_r, zetanc_r)

recover the retrieved values from the rearranged to original radii.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nrotmin

minimum wavenumber for rotational components

integer, intent(in) :: nrot

maximum wavenumber for rotational components

integer, intent(in) :: ndivmin

minimum wavenumber for divergent components

integer, intent(in) :: ndiv

maximum wavenumber for divergent components

integer, intent(in) :: nr_in

innermost array number in radius

integer, intent(in) :: nr_out

outermost array number in radius (skip)

integer, intent(in) :: nr_out_org

outermost array number in radius (orig)

integer, intent(in) :: nt

azimuthal array number

double precision, intent(in) :: undef

undefined value

logical, intent(in), dimension(nr_in:nr_out_org,1:nt) :: undef_grid

flag of undefined grid (.true. is undef)

integer, intent(in), dimension(nr_in:nr_out_org) :: nn_grid

grid number in rearranged each radius

double precision, intent(inout), dimension(nr_in:nr_out_org,1:nt) :: VTtot_rt_t
double precision, intent(inout), dimension(nr_in:nr_out_org,1:nt) :: VRtot_rt_t
double precision, intent(inout), dimension(nr_in:nr_out_org,1:nt) :: VRT0_rt_t
double precision, intent(inout), dimension(nr_in:nr_out_org,1:nt) :: VDR0_rt_t
double precision, intent(inout), dimension(nrotmin:nrot,nr_in:nr_out_org,1:nt) :: VRTn_rt_t
double precision, intent(inout), dimension(nrotmin:nrot,nr_in:nr_out_org,1:nt) :: VRRn_rt_t
double precision, intent(inout), dimension(ndivmin:ndiv,nr_in:nr_out_org,1:nt) :: VDTm_rt_t
double precision, intent(inout), dimension(ndivmin:ndiv,nr_in:nr_out_org,1:nt) :: VDRm_rt_t
double precision, intent(inout), dimension(nr_in:nr_out_org,1:nt) :: VRT0_GVTD_rt_t
double precision, intent(inout), dimension(nr_in:nr_out_org,1:nt) :: VDR0_GVTD_rt_t
double precision, intent(inout), dimension(nrotmin:nrot,nr_in:nr_out_org) :: VRTns_r
double precision, intent(inout), dimension(nrotmin:nrot,nr_in:nr_out_org) :: VRTnc_r
double precision, intent(inout), dimension(nrotmin:nrot,nr_in:nr_out_org) :: VRRns_r
double precision, intent(inout), dimension(nrotmin:nrot,nr_in:nr_out_org) :: VRRnc_r
double precision, intent(inout), dimension(nr_in:nr_out_org,1:nt) :: Vn_0_rt_t
double precision, intent(inout), dimension(nrotmin:nrot,nr_in:nr_out_org,1:nt) :: phin_rt_t
double precision, intent(inout), dimension(nrotmin:nrot,nr_in:nr_out_org,1:nt) :: zetan_rt_t
double precision, intent(inout), dimension(nrotmin:nrot,nr_in:nr_out_org) :: zetans_r
double precision, intent(inout), dimension(nrotmin:nrot,nr_in:nr_out_org) :: zetanc_r

public subroutine check_undef_grid(vval, undefv, undeflag)

check missing grids

Arguments

Type IntentOptional Attributes Name
double precision, intent(in) :: vval(:,:)

input data

double precision, intent(in) :: undefv

undefined value

logical, intent(out) :: undeflag(size(vval,1),size(vval,2))

undefined flag (.true.)