nakametpy.kinematics module

nakametpy.kinematics.advection_h(var, wind_u, wind_v, dx, dy, wrfon=0)[source]

変数の移流を求める関数.

dx, dyは``distance_4d``を使って求め、それらをこの関数の引数に渡すと計算できる. dx, dyにintまたはfloatを代入するとそれが全てのdx, dyとなる.

Parameters:
  • var (numpy.ndarray) –

    variable

    計算したい変数

  • wind_u (numpy.ndarray) –

    eastward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • wind_v (numpy.ndarray) –

    northward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • dx (numpy.ndarray) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • wrfon (int) –

    Flag whether input data is wrfout or not.

    入力データがwrfoutか否かのフラグ

Returns:

advection

Return type:

numpy.ndarray

nakametpy.kinematics.advection_h_3d(var, wind_u, wind_v, dx, dy, wrfon=0)[source]

変数の移流を求める関数.

distance_3dを使ってdx, dyを求め、それらをこの関数の引数に渡すと計算できる

Parameters:
  • var (numpy.ndarray) –

    variable

    計算したい変数

  • wind_u (numpy.ndarray) –

    eastward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • wind_v (numpy.ndarray) –

    northward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • dx (numpy.ndarray) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • wrfon (int) –

    Flag whether input data is wrfout or not

    入力データがwrfoutか否かのフラグ

Returns:

advection

Return type:

numpy.ndarray

nakametpy.kinematics.advection_h_4d(var, wind_u, wind_v, dx, dy, wrfon=0)[source]

変数の移流を求める関数.

distance_4dを使ってdx, dyを求め、それらをこの関数の引数に渡すと計算できる

Parameters:
  • var (numpy.ndarray) –

    variable

    計算したい変数

  • wind_u (numpy.ndarray) –

    eastward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • wind_v (numpy.ndarray) –

    northward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • dx (numpy.ndarray) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • wrfon (int) –

    Flag whether input data is wrfout or not.

    入力データがwrfoutか否かのフラグ

Returns:

advection

Return type:

numpy.ndarray

nakametpy.kinematics.ageostrophic_wind(geopotential, u_wind, v_wind, dx, dy, f0=0.0001)[source]

非地衡風成分を求める関数.

実際の風の東西・南北成分から地衡風成分を引く.

Parameters:
  • geopotential (numpy.ndarray) –

    Geopotential (Not Geopotential Height)

    ジオポテンシャル (ジオポテンシャル高度では無い)

  • u_wind (numpy.ndarray) – eastward wind

  • v_wind (numpy.ndarray) – northward wind

  • dx (numpy.ndarray) – 東西方向の距離

  • dy (numpy.ndarray) – 南北方向の距離

Returns:

ageostrophic wind

非地衡風

Return type:

numpy.ndarray

nakametpy.kinematics.coriolis_parameter(lat)[source]

コリオリパラメタを求める関数.

Parameters:

lat (numpy.ndarray) – Pressure

Returns:

Corioli’s Parameter

Return type:

numpy.ndarray

Note

\[f=2\bg{\Omega}\sin\phi\]
nakametpy.kinematics.dis_azi_from_point(lats, lons, *, idx_flag=False, clat=None, clon=None, clat_idx=None, clon_idx=None, lev_len=None, t_len=None)[source]

ある地点からの距離と方位角を求める関数

次元は[(時間、鉛直方向)、緯度、経度]である. 地球半径の値は6371229mを使用.

Calculate the distance and azimuth from latitude and longitude

Parameters:
  • lats (numpy.ndarray) – latitude(1d or 2d) in degree

  • lons (numpy.ndarray) – longitude(1d or 2d) in degree

  • lat_idx (int) –

  • lon_idx (int) –

Returns:

dr((t_len, lev_len), lats, lons), azimuth((t_len, lev_len), lats, lons)

Return type:

numpy.ndarray

nakametpy.kinematics.distance(lons, lats, lev_len=None, t_len=None)[source]

各格子点間の距離を求める関数.

次元は[(時間、鉛直方向)、緯度、経度]である. 地球半径の値は6371229mを使用.

Calculate the distance from latitude and longitude

Parameters:
  • lons (numpy.ndarray) – longitude(1d or 2d) in degree

  • lats (numpy.ndarray) – latitude(1d or 2d) in degree

Returns:

dx((t_len, lev_len), lats, lons), dy((t_len, lev_len), lats, lons)

Return type:

numpy.ndarray

nakametpy.kinematics.distance_2d(lons, lats)[source]

各格子点間の距離を求める関数.

次元は[時間、緯度、経度]である. 地球半径の値は6371229mを使用.

Calculate the distance from latitude and longitude

Parameters:
  • lons (numpy.ndarray) – longitude(1d or 2d) in degree

  • lats (numpy.ndarray) – latitude(1d or 2d) in degree

Returns:

dx(lats, lons), dy(lats, lons)

Return type:

numpy.ndarray

nakametpy.kinematics.distance_3d(lons, lats, len3d=24)[source]

各格子点間の距離を求める関数.

次元は[時間、緯度、経度]である. Single Levelの変数を計算する際に用いる.

地球半径の値は6371229mを使用.

Calculate the distance from latitude and longitude

Parameters:
  • lons (numpy.ndarray) – longitude(1d or 2d) in degree

  • lats (numpy.ndarray) – latitude(1d or 2d) in degree

Returns:

dx(t_len, lats, lons), dy(t_len, lats, lons)

Return type:

numpy.ndarray

nakametpy.kinematics.distance_4d(lons, lats, lev_len=37, t_len=24)[source]

各格子点間の距離を求める関数.

次元は[時間、鉛直方向、緯度、経度]である. 地球半径の値は6371229mを使用.

Calculate the distance from latitude and longitude

Parameters:
  • lons (numpy.ndarray) – longitude(1d or 2d) in degree

  • lats (numpy.ndarray) – latitude(1d or 2d) in degree

Returns:

dx(t_len, lev_len, lats, lons), dy(t_len, lev_len, lats, lons)

Return type:

numpy.ndarray

nakametpy.kinematics.divergence(fx, fy, dx, dy, wrfon=0)[source]

直交座標系において変数の発散を求める関数.

divergence_2dの拡張で3次元以上の配列に対応している. distance_2d, 3d, 4dを使ってdx, dyを求め、それらをこの関数の引数に渡すと計算できる

Parameters:
  • fx (numpy.ndarray) –

    x-flux

    x(東西)方向のフラックス

  • fy (numpy.ndarray) –

    y-flux

    y(南北)方向のフラックス

  • dx (numpy.ndarray or int or float) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray or int or float) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • wrfon (int) –

    Flag whether input data is wrfout or not

    入力データがwrfoutか否かのフラグ

Returns:

divergence

Return type:

numpy.ndarray

nakametpy.kinematics.divergence_2d(fx, fy, dx, dy, wrfon=0)[source]

直交座標系において変数の発散を求める関数.

distance_2dを使ってdx, dyを求め、それらをこの関数の引数に渡すと計算できる

Parameters:
  • fx (numpy.ndarray) –

    x-flux

    x(東西)方向のフラックス

  • fy (numpy.ndarray) –

    y-flux

    y(南北)方向のフラックス

  • dx (numpy.ndarray) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • wrfon (int) –

    Flag whether input data is wrfout or not

    入力データがwrfoutか否かのフラグ

Returns:

divergence

Return type:

numpy.ndarray

nakametpy.kinematics.geopotential_to_height(geopotential)[source]

ジオポテンシャルから高度を求める関数.

Parameters:

height (numpy.ndarray) – Geopotential

Returns:

Height

Return type:

numpy.ndarray

Note

\[z = \frac{\Phi R_e}{gR_e-\Phi}\]
nakametpy.kinematics.geostrophic_wind(geopotential, dx, dy, f0=0.0001)[source]

地衡風を求める関数.

ジオポテンシャルの水平微分を行い、コリオリパラメタで割った後、 u成分にマイナスをかける.

Parameters:
  • geopotential (numpy.ndarray) –

    Geopotential (Not Geopotential Height)

    ジオポテンシャル (ジオポテンシャル高度では無い)

  • dx (numpy.ndarray) – 東西方向の距離

  • dy (numpy.ndarray) – 南北方向の距離

Returns:

geostrophic wind

地衡風

Return type:

numpy.ndarray

nakametpy.kinematics.gradient_h(var, dx, dy, wrfon=0)[source]

変数の勾配を求める関数

dx, dyは`distance_nd`を使って求め、それらをこの関数の引数に渡すと計算できる. dx, dyにintまたはfloatを代入した場合、一定値として扱われる.

Parameters:
  • var (numpy.ndarray) –

    variable

    計算したい変数

  • dx (numpy.ndarray or int or float) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray or int or float) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • wrfon (int) –

    Flag whether input data is wrfout or not

    入力データがwrfoutか否かのフラグ

Returns:

grad_x(nd), grad_y(nd)

Return type:

numpy.ndarray

nakametpy.kinematics.gradient_h_2d(var, dx, dy, wrfon=0)[source]

変数の勾配を求める関数.

distance_4dを使ってdx, dyを求め、それらをこの関数の引数に渡すと計算できる

Parameters:
  • var (numpy.ndarray) –

    variable

    計算したい変数

  • dx (numpy.ndarray or int or float) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray or int or float) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • wrfon (int) –

    Flag whether input data is wrfout or not

    入力データがwrfoutか否かのフラグ

Returns:

grad_x(2d), grad_y(2d)

Return type:

numpy.ndarray

nakametpy.kinematics.gradient_h_3d(var, dx, dy, wrfon=0)[source]

変数の勾配を求める関数.

distance_4dを使ってdx, dyを求め、それらをこの関数の引数に渡すと計算できる

Parameters:
  • var (numpy.ndarray) –

    variable

    計算したい変数

  • dx (numpy.ndarray or int or float) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray or int or float) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • wrfon (int) –

    Flag whether input data is wrfout or not

    入力データがwrfoutか否かのフラグ

Returns:

grad_x(3d), grad_y(3d)

Return type:

numpy.ndarray

nakametpy.kinematics.gradient_h_4d(var, dx, dy, wrfon=0)[source]

変数の勾配を求める関数.

distance_4dを使ってdx, dyを求め、それらをこの関数の引数に渡すと計算できる

Parameters:
  • var (numpy.ndarray) –

    variable

    計算したい変数

  • dx (numpy.ndarray or int or float) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray or int or float) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • wrfon (int) –

    Flag whether input data is wrfout or not

    入力データがwrfoutか否かのフラグ

Returns:

grad_x(4d), grad_y(4d)

Return type:

numpy.ndarray

nakametpy.kinematics.gravitational_constant(height)[source]

重力定数を求める関数.

Parameters:

height (numpy.ndarray) – height

Returns:

Gravitational constant

Return type:

numpy.ndarray

Note

\[g(z) = g0\left(\frac{R_e}{R_e+z}\right)^2\]
nakametpy.kinematics.height_to_geopotential(height)[source]

高度からジオポテンシャルを求める関数.

Parameters:

height (numpy.ndarray) – height

Returns:

Geopotential

Return type:

numpy.ndarray

Note

\[\Phi = \frac{g(z)R_ez}{R_e+z}\]
nakametpy.kinematics.lapse_rate(pressure, temperature, height)[source]

実際の断熱減率などの呼び方がある.

詳しくはHolton 5th edition pp54

変数はすべて同じ形で無ければならない.

Variables should be the same shape.

Parameters:
  • pressure (numpy.ndarray) – Pressure

  • temperature (numpy.ndarray) – Temperature

  • height (numpy.ndarray) – (Geopotential) Height

Returns:

Lapse Rate

Return type:

numpy.ndarray

nakametpy.kinematics.p2p_distance(lon1, lat1, lon2, lat2)[source]

単一の地点間の距離を求める関数.

Parameters:
  • lon1 (numpy.ndarray) – Longitude of point1

  • lat1 (numpy.ndarray) – Latitude of point1

  • lon2 (numpy.ndarray) – Longitude of point2

  • lat2 (numpy.ndarray) – Latitude of point2

Returns:

distance between point1 and point2

Return type:

numpy.ndarray

nakametpy.kinematics.pressure_3d(pres, *, lat_dim=201, lon_dim=401)[source]

1次元の気圧の配列から3次元の気圧の配列を返す関数.

気圧を計算に用いる際に使います.

Parameters:

pres (numpy.ndarray) – pressure(1d)

Returns:

pressure(3d)

Return type:

numpy.ndarray

nakametpy.kinematics.pressure_4d(pres, *, time_dim=24, lat_dim=201, lon_dim=401)[source]

1次元の気圧の配列から4次元の気圧の配列を返す関数.

気圧を計算に用いる際に使います.

Parameters:

pres (numpy.ndarray) – pressure(1d)

Returns:

pressure(4d)

Return type:

numpy.ndarray

nakametpy.kinematics.pressure_nd(pres, *, time_dim=None, lat_dim=201, lon_dim=401)[source]

1次元の気圧の配列からn次元の気圧の配列を返す関数.

気圧を計算に用いる際に使います.

Parameters:

pres (numpy.ndarray) – pressure(1d)

Returns:

pressure(nd)

Return type:

numpy.ndarray

nakametpy.kinematics.ps2ps_distance(lon1, lat1, lon2, lat2)[source]

地点間の距離を求める関数.

単一の地点間の距離を求める場合はp2p_distanceの方が処理が早い.

Parameters:
  • lon1 (numpy.ndarray) – Longitude of point(s)1

  • lat1 (numpy.ndarray) – Latitude of point(s)1

  • lon2 (numpy.ndarray or int or float) – Longitude of point(s)2

  • lat2 (numpy.ndarray or int or float) – Latitude of point(s)2

Returns:

distance between points1 and points2

Return type:

numpy.ndarray

nakametpy.kinematics.pseudoadiabatic_lapse_rate(pressure, temperature)[source]

偽断熱減率、湿潤断熱減率などの呼び方がある.

詳しくはHolton 5th edition pp61

変数はすべて同じ形で無ければならない.

Variables should be the same shape.

Parameters:
  • pressure (numpy.ndarray) – Pressure

  • temperature (numpy.ndarray) – Temperature

Returns:

Psuedadiabatic Lapse Rate

Return type:

numpy.ndarray

Note

\[\Gamma_s\equiv-\frac{dT}{dz}=\Gamma_d\frac{[1+L_cq_s/(RT)]}{\left[1+\varepsilon L_c^2q_s/(c_pRT^2)\right]}\]
nakametpy.kinematics.q_1(temperature_1, temperature_2, temperature_3, wind_u, wind_v, p_velocity, pressure, dx, dy, time_step=3600, wrfon=0)[source]

Q1を気温を用いて求める関数.

この関数は時間発展を計算する項が含まれているため、4次元の配列で計算される. temperatureに関しては時間変化は中央差分を用いるため、計算したい時間の気温だけで無く、 その前後の時間の気温のデータも与える必要がある.

dx, dyは`distance_4d`を使って求め、それらをこの関数の引数に渡すと計算できる.

Parameters:
  • temperature_1 (numpy.ndarray) –

    temperature

    計算したい時間の前の時間のtemp. temperature_2と同じ形で無ければならない.

  • temperature_2 (numpy.ndarray) –

    temperature

    計算したい時間のtemp.

  • temperature_3 (numpy.ndarray) –

    temperature

    計算したい時間の後の時間のtemp. temperature_2と同じ形で無ければならない.

  • wind_u (numpy.ndarray) –

    eastward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • wind_v (numpy.ndarray) –

    northward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • p_velocity (numpy.ndarray) –

    vertical p velocity. The same shape as var.

    変数と同じ形で無ければならない.

  • pressure (numpy.ndarray) –

    pressure. The same shape as var.

    変数と同じ形で無ければならない.

  • dx (numpy.ndarray) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • timestep (float) –

    default = 3600 (for ERA5).

    This varies on dataset.

    使用するデータによって変更する必要がある.

  • wrfon (int) –

    Flag whether input data is wrfout or not.

    入力データがwrfoutか否かのフラグ

Returns:

Q1 or Q11, Q12, Q13

Return type:

numpy.ndarray

nakametpy.kinematics.q_2_rh(temperature_1, temperature_2, temperature_3, rh_1, rh_2, rh_3, wind_u, wind_v, p_velocity, pressure, dx, dy, time_step=3600, wrfon=0)[source]

Q2を相対湿度と気温を用いて混合比から求める関数.

この関数は時間発展を計算する項が含まれているため、4次元の配列で計算される. temperatureに関しては時間変化は中央差分を用いるため、計算したい時間の気温だけで無く その前後の時間の気温のデータも与える必要がある.

distance_4dを使ってdx, dyを求め、それらをこの関数の引数に渡すと計算できる.

Parameters:
  • temperature_1 (numpy.ndarray) –

    temperature

    計算したい時間の前の時間のtemp. temperature_2と同じ形で無ければならない.

  • temperature_2 (numpy.ndarray) –

    temperature

    計算したい時間のtemp.

  • temperature_3 (numpy.ndarray) –

    temperature

    計算したい時間の後の時間のtemp. temperature_2と同じ形で無ければならない.

  • rh_1 (numpy.ndarray) –

    Relative Humidity

    計算したい時間の前の時間の相対湿度. rh_2と同じ形で無ければならない.

  • rh_2 (numpy.ndarray) –

    Relative Humidity

    計算したい時間の相対湿度.

  • rh_3 (numpy.ndarray) –

    Relative Humidity

    計算したい時間の後の時間の相対湿度. rh_2と同じ形で無ければならない.

  • wind_u (numpy.ndarray) –

    eastward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • wind_v (numpy.ndarray) –

    northward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • p_velocity (numpy.ndarray) –

    vertical p velocity. The same shape as var.

    変数と同じ形で無ければならない.

  • pressure (numpy.ndarray) –

    pressure. The same shape as var.

    変数と同じ形で無ければならない.

  • dx (numpy.ndarray) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • timestep (float) –

    default = 3600 (for ERA5)

    This varies on dataset.

    使用するデータによって変更する必要がある.

  • wrfon (int) –

    Flag whether input data is wrfout or not.

    入力データがwrfoutか否かのフラグ

Returns:

Q2 or Q21, Q22, Q23

Return type:

numpy.ndarray

nakametpy.kinematics.q_2_sh_mix(sh_1, sh_2, sh_3, wind_u, wind_v, p_velocity, pressure, dx, dy, time_step=3600, wrfon=0)[source]

Q2を比湿を用いて混合比から求める関数.

この関数は時間発展を計算する項が含まれているため、4次元の配列で計算される. temperatureに関しては時間変化は中央差分を用いるため、計算したい時間の気温だけで無く その前後の時間の気温のデータも与える必要がある.

dx, dyは`distance_4d`を使って求め、それらをこの関数の引数に渡すと計算できる.

Parameters:
  • sh_1 (numpy.ndarray) –

    Relative Humidity

    計算したい時間の前の時間の比湿. sh_2と同じ形で無ければならない.

  • sh_2 (numpy.ndarray) –

    Relative Humidity

    計算したい時間の比湿

  • sh_3 (numpy.ndarray) –

    Relative Humidity

    計算したい時間の後の時間の比湿. sh_2と同じ形で無ければならない.

  • wind_u (numpy.ndarray) –

    eastward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • wind_v (numpy.ndarray) –

    northward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • p_velocity (numpy.ndarray) –

    vertical p velocity. The same shape as var.

    変数と同じ形で無ければならない.

  • pressure (numpy.ndarray) –

    pressure. The same shape as var.

    変数と同じ形で無ければならない.

  • dx (numpy.ndarray) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • timestep (float) –

    default = 3600 (for ERA5)

    This varies on dataset.

    使用するデータによって変更する必要がある.

  • wrfon (int) –

    Flag whether input data is wrfout or not.

    入力データがwrfoutか否かのフラグ

Returns:

Q2 or Q21, Q22, Q23

Return type:

numpy.ndarray

nakametpy.kinematics.q_2_sh_sh(sh_1, sh_2, sh_3, wind_u, wind_v, p_velocity, pressure, dx, dy, time_step=3600, wrfon=0)[source]

Q2を比湿を用いて比湿から求める関数.

この関数は時間発展を計算する項が含まれているため、4次元の配列で計算される. temperatureに関しては時間変化は中央差分を用いるため、計算したい時間の気温だけで無く その前後の時間の気温のデータも与える必要がある.

dx, dyは`distance_4d`を使って求め、それらをこの関数の引数に渡すと計算できる.

Parameters:
  • sh_1 (numpy.ndarray) –

    Relative Humidity

    計算したい時間の前の時間の比湿. sh_2と同じ形で無ければならない.

  • sh_2 (numpy.ndarray) –

    Relative Humidity

    計算したい時間の比湿.

  • sh_3 (numpy.ndarray) –

    Relative Humidity

    計算したい時間の後の時間の比湿. sh_2と同じ形で無ければならない.

  • wind_u (numpy.ndarray) –

    eastward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • wind_v (numpy.ndarray) –

    northward wind. The same shape as var.

    変数と同じ形で無ければならない.

  • p_velocity (numpy.ndarray) –

    vertical p velocity. The same shape as var.

    変数と同じ形で無ければならない.

  • pressure (numpy.ndarray) –

    pressure. The same shape as var.

    変数と同じ形で無ければならない.

  • dx (numpy.ndarray) –

    var.shape[-1]-1 == dx.shape[-1]

    経度方向の次元はvar.shape[-1]-1でなければならない

  • dy (numpy.ndarray) –

    var.shape[-2]-1 == dy.shape[-2]

    経度方向の次元はvar.shape[-2]-1でなければならない

  • timestep (float) –

    default = 3600 (for ERA5)

    This varies on dataset.

    使用するデータによって変更する必要がある.

  • wrfon (int) –

    Flag whether input data is wrfout or not.

    入力データがwrfoutか否かのフラグ

Returns:

Q2 or Q21, Q22, Q23

Return type:

numpy.ndarray

nakametpy.kinematics.relative_vorticity(u, v, dx, dy)[source]

相対渦度を求める関数.

Parameters:
  • u (numpy.ndarray) – eastward wind

  • v (numpy.ndarray) – northward wind

  • dx (numpy.ndarray) – 東西方向の距離

  • dy (numpy.ndarray) – 南北方向の距離

Returns:

Relative Vorticity

相対渦度

Return type:

numpy.ndarray

nakametpy.kinematics.richardson_number(temp, rh, height, pres, u, v)[source]

リチャードソン数を求める関数.

変数はすべて同じ形で無ければならない.

Variables should be the same shape.

Parameters:
  • temp (numpy.ndarray) – Temperature

  • rh (numpy.ndarray) – Relative Humidity

  • height (numpy.ndarray) – (Geopotential) Height

  • pres (numpy.ndarray) – pressure

  • u (numpy.ndarray) – eastward wind

  • v (numpy.ndarray) – northward wind

Returns:

Richardson Number

Return type:

numpy.ndarray

nakametpy.kinematics.static_stability(pressure, temperature)[source]

大気の安定度を求める関数.

変数はすべて同じ形で無ければならない.

Variables should be the same shape.

Parameters:
  • pressure (numpy.ndarray) – Pressure

  • temperature (numpy.ndarray) – Temperature

Returns:

Static Stability

Return type:

numpy.ndarray

Note

\[-\frac{RT}{p}\left(\frac{\partial \log\theta}{\partial p}\right)\]
nakametpy.kinematics.uv2dv_cfd(fx, fy, lat, lon, boundOpt=4)[source]

Divergence caluculation function from NCL.

Parameters:
  • fx (numpy.ndarray) –

    x-flux

    x(東西)方向のフラックス

  • fy (numpy.ndarray) –

    y-flux

    y(南北)方向のフラックス

  • lat (numpy.ndarray) – latitude

  • lon (numpy.ndarray) – longitude

  • boundOpt (int) –

    boundOpt

    今は4(境界は片方の成分の収束のみで計算)のみ対応

Returns:

divergence with latitude parameter

Return type:

numpy.ndarray

nakametpy.kinematics.uv2vr_cfd(fx, fy, lat, lon, boundOpt=4)[source]

Relative vorticity caluculation function from NCL.

Parameters:
  • fx (numpy.ndarray) –

    x-flux

    x(東西)方向のフラックス

  • fy (numpy.ndarray) –

    y-flux

    y(南北)方向のフラックス

  • lat (numpy.ndarray) – latitude

  • lon (numpy.ndarray) – longitude

  • boundOpt (int) –

    boundOpt

    今は4(境界は片方の成分の渦度のみで計算)のみ対応

Returns:

divergence with latitude parameter

Return type:

numpy.ndarray

nakametpy.kinematics.vert_grad(variables, pres_4d, z_dim=- 3)[source]

変数の鉛直圧力勾配を求める関数.

Parameters:
  • variables (numpy.ndarray) –

    variable

    計算したい変数

  • pres_nd (numpy.ndarray) –

    pressure(nd). The same shape as var Use pressure_nd from 1d pressure array.

    変数と同じ形で無ければならない.

Returns:

vertical gradient

Return type:

numpy.ndarray

Note

\[\begin{split}{VerticalGradient}_{n+1/2} &= \frac{-\left(f(p_{n}) - f(p_{n+1})\right)}{-\left(p_{n} - p_{n+1}\right)} \\ &= \frac{\left(f(p_{n+1}) - f(p_{n})\right)}{\left(p_{n+1} - p_{n}\right)}\end{split}\]
nakametpy.kinematics.vert_grad_2d_height(variables, height, z_dim=0)[source]

変数の鉛直高度勾配を求める関数.

Parameters:
  • variables (numpy.ndarray) –

    variable.

    計算したい変数

  • height (numpy.ndarray) –

    height(2d). The same shape as var.

    ジオポテンシャル高度を用いる.

Returns:

vertical gradient

Return type:

numpy.ndarray

nakametpy.kinematics.vert_grad_3d(variables, pres_3d, z_dim=0)[source]

変数の鉛直圧力勾配を求める関数.

Parameters:
  • variables (numpy.ndarray) –

    variable

    計算したい変数

  • pres_3d (numpy.ndarray) –

    pressure(3d). The same shape as var Use pressure_3d from 1d pressure array.

    変数と同じ形で無ければならない.

  • wrfon (int) –

    Flag whether input data is wrfout or not

    入力データがwrfoutか否かのフラグ

Returns:

vertical gradient

Return type:

numpy.ndarray

Note

\[\begin{split}{VerticalGradient}_{n+1/2} &= \frac{-\left(f(p_{n}) - f(p_{n+1})\right)}{-\left(p_{n} - p_{n+1}\right)} \\ &= \frac{\left(f(p_{n+1}) - f(p_{n})\right)}{\left(p_{n+1} - p_{n}\right)}\end{split}\]
nakametpy.kinematics.vert_grad_3d_height(variables, height, z_dim=0)[source]

変数の鉛直高度勾配を求める関数.

Parameters:
  • variables (numpy.ndarray) –

    variable

    計算したい変数

  • height (numpy.ndarray) –

    height(3d). The same shape as var.

    ジオポテンシャル高度を用いる.

Returns:

vertical gradient

Return type:

numpy.ndarray

nakametpy.kinematics.vert_grad_4d(variables, pres_4d, z_dim=1)[source]

変数の鉛直圧力勾配を求める関数.

Parameters:
  • variables (numpy.ndarray) –

    variable

    計算したい変数

  • pres_4d (numpy.ndarray) – pressure(4d). The same shape as var Use pressure_4d from 1d pressure array. 変数と同じ形で無ければならない.

Returns:

vertical gradient

Return type:

numpy.ndarray

Note

\[\begin{split}{VerticalGradient}_{n+1/2} &= \frac{-\left(f(p_{n}) - f(p_{n+1})\right)}{-\left(p_{n} - p_{n+1}\right)} \\ &= \frac{\left(f(p_{n+1}) - f(p_{n})\right)}{\left(p_{n+1} - p_{n}\right)}\end{split}\]
nakametpy.kinematics.vert_grad_4d_height(variables, height, z_dim=1)[source]

変数の鉛直高度勾配を求める関数.

Parameters:
  • variables (numpy.ndarray) –

    variable.

    計算したい変数

  • height (numpy.ndarray) –

    height(4d). The same shape as var.

    ジオポテンシャル高度を用いる.

Returns:

vertical gradient

Return type:

numpy.ndarray