Python包执行气象计算

metlib的Python项目详细描述


梅特利布

Python包执行气象计算

要求

使用

参见下一个jupyter笔记本的例子,其中计算了相对涡度、风的水平散度和温度平流,还说明了如何沿纬度、经度或时间创建纬度和垂直剖面图。在

参考指南

单击该项以查看函数及其说明。在

中心差异限制

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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java类。getResource和ClassLoader。getSystemResource:有没有理由选择其中一个而不是另一个?   在Java中以编程方式粘贴后恢复剪贴板   Java字符串到日期没有时间   JavaSpring注释:@Component起作用,@Repository不起作用   java“addScript”在HSQL中是否有最大记录计数?   java如何将值从JDialog框返回到父JFrame?   java我的模块库的用户有没有办法访问尚未导出的类?   java javac:未找到命令   java如何解决jsoup错误:无法找到请求目标的有效证书路径   类中的java作用域变量   Java中集合实现中的arraylist add()方法不起作用   java如何使用while循环和从用户接收输入来近似Pi?   java Spring安全CSRF培训模式   在安卓系统中,如何通过在警报框外单击来限制用户?