Python包执行气象计算
metlib的Python项目详细描述
梅特利布
Python包执行气象计算
要求
使用
参见下一个jupyter笔记本的例子,其中计算了相对涡度、风的水平散度和温度平流,还说明了如何沿纬度、经度或时间创建纬度和垂直剖面图。在
- 在
使用netCDF4:
- 使用basemap/cartopy、matplotlib和pcolormesh/contourf(example)创建lat lon图。在
- 使用matplotlib和pcolormesh/contourf(example)创建垂直纵断面图。
- 在
使用xarray:
- 使用basemap/cartopy、matplotlib和pcolormesh/contourf(example)创建lat lon图。在
- 使用matplotlib和pcolormesh/contourf(example)创建垂直纵断面图。
- 在
- 使用xarray.plot、cartopy、matplotlib和pcolormesh/contourf(example)创建横向打印。在
- 使用xarray.plot、matplotlib和pcolormesh/contourf(example)创建垂直纵断面图。
参考指南
单击该项以查看函数及其说明。在
中心差异限制
cdiff(字段,Dim)
Calculates a centered finite difference of Numpy array or Xarray.DataArray.
Parameters
----------
Field: Numpy array or Xarray.DataArray
Their structure can be:
- 1D [x]
- 2D [y,x]
- 3D [z,y,x]
- 4D [t,z,y,x]
Dim: String (str)
Defines axis of derivative and can be 'X', 'Y', 'Z', 'T'.
Returns
-------
CDIFF: Numpy array or Xarray.DataArray
Centered finite difference in Dim of Field. The shape is the same that input(Field).
详细信息>
相对涡度
{UComp,相对涡度=None
^{pr2}$详细信息>
绝对涡度
绝对涡度(UComp,VComp,Lon=None,Lat=None)
Calculates the absolute vorticity of horizontal wind.
Parameters
----------
UComp: Numpy array or Xarray.DataArray
Zonal component of wind. Their structure can be:
- 2D [y,x]
- 3D [z,y,x] or [t,y,x]
- 4D [t,z,y,x]
VComp: Numpy array or Xarray.DataArray
Meridional component of wind. Their structure can be:
- 2D [y,x]
- 3D [z,y,x] or [t,y,x]
- 4D [t,z,y,x]
Lon: Numpy array
2D array with the longitudes of UComp and VComp.
If UComp and VComp are xarray.DataArray is not necessary define this parameter.
Lat: Numpy array
2D array with the latitudes of UComp and VComp.
If UComp and VComp are xarray.DataArray is not necessary define this parameter.
Returns
-------
avor: Numpy array or Xarray.DataArray
Absolute relative vorticity of Ucomp and Vcomp [s**-1]
详细信息>
分歧
difference(UComp,VComp,Lon=None,Lat=None)
Calculates the divergence of horizontal wind or some vector field.
Parameters
----------
UComp: Numpy array or Xarray.DataArray
Zonal component of wind. Their structure can be:
- 2D [y,x]
- 3D [z,y,x] or [t,y,x]
- 4D [t,z,y,x]
VComp: Numpy array or Xarray.DataArray
Meridional component of wind. Their structure can be:
- 2D [y,x]
- 3D [z,y,x] or [t,y,x]
- 4D [t,z,y,x]
Lon: Numpy array
2D array with the longitudes of UComp and VComp.
If UComp and VComp are xarray.DataArray is not necessary define this parameter.
Lat: Numpy array
2D array with the latitudes of UComp and VComp.
If UComp and VComp are xarray.DataArray is not necessary define this parameter.
Returns
-------
div: Numpy array or Xarray.DataArray
Horizontal divergence of Ucomp and Vcomp [1/s]
Negative divergence is also known as convergence.
详细信息>
平流
平流(Field,UComp,VComp,Lon=None,Lat=None)
Calculates the horizontal adveccion of Field.
Parameters
----------
Field: Numpy array or Xarray.DataArray
Their structure can be:
- 2D [y,x]
- 3D [z,y,x] or [t,y,x]
- 4D [t,z,y,x]
UComp: Numpy array or Xarray.DataArray
Zonal component of wind. Their structure can be:
- 2D [y,x]
- 3D [z,y,x] or [t,y,x]
- 4D [t,z,y,x]
VComp: Numpy array or Xarray.DataArray
Meridional component of wind. Their structure can be:
- 2D [y,x]
- 3D [z,y,x] or [t,y,x]
- 4D [t,z,y,x]
Lon: Numpy array
2D array with the longitudes of UComp and VComp.
If UComp and VComp are xarray.DataArray is not necessary define this parameter.
Lat: Numpy array
2D array with the latitudes of UComp and VComp.
If UComp and VComp are xarray.DataArray is not necessary define this parameter.
Returns
-------
adv: Numpy array or Xarray.DataArray
Horizontal advection of Field [Field_units/s]
详细信息>
潜在温度
位势温度(温度,水平=无)
Calculates the potential temperature.
Parameters
----------
Temperature: Numpy array or Xarray.DataArray
Temperature field in Kelvin. Their structure can be:
- 2D [y,x]
- 3D [z,y,x] or [t,y,x]
- 4D [t,z,y,x]
Levels: Numpy array
1D array with pressure levels of Temperature.
Returns
-------
PTemp: Numpy array or Xarray.DataArray
Potential temperature [K].
详细信息>
位涡度
位涡度(温度,UComp,VComp,Lon=None,Lat=None,Levels=None)
Calculates the baroclinic potential vorticity.
Parameters
----------
Temperature: Numpy array or Xarray.DataArray
Temperature field in Kelvin. Their structure can be:
- 3D [z,y,x]
- 4D [t,z,y,x]
UComp: Numpy array or Xarray.DataArray
Zonal component of wind. Their structure can be:
- 3D [z,y,x]
- 4D [t,z,y,x]
VComp: Numpy array or Xarray.DataArray
Meridional component of wind. Their structure can be:
- 3D [z,y,x]
- 4D [t,z,y,x]
Lon: Numpy array
2D array with the longitudes of UComp and VComp.
If UComp and VComp are xarray.DataArray is not necessary define this parameter.
Lat: Numpy array
2D array with the latitudes of UComp and VComp.
If UComp and VComp are xarray.DataArray is not necessary define this parameter.
Levels: Numpy array
1D array with pressure levels of Temperature.
If UComp and VComp are xarray.DataArray is not necessary define this parameter.
Returns
-------
PVor: Numpy array or Xarray.DataArray
Baroclinic potential voticity [1/s].
详细信息>
安装
您可以使用以下命令将metlib安装在Linux、Windows或其他平台上的python2或3上(我建议在您最喜欢的Python环境中安装metlib)。
,来自PYPI,使用pip(推荐方法)
pip install metlib
来自github的
- 下载ZIP(metlib-主.zip)和以下命令:
unzip metlib-master.zip
cd metlib-master
python setup.py install
cd .. # it is necessary to leave the installation folder
- 或者,克隆github包:
clone https://github.com/joaohenry23/metlib.git
cd metlib
python setup.py install
cd .. # it is necessary to leave the installation folder
检查包是否已安装
pip show metlib
更新到最新版本
pip install --upgrade metlib
支持
如果您有任何问题,请随时写信给:
joaohenry23@gmail.com
- 项目
标签: