PyMDFS
高级的、易用的 Micaps 在线数据读取包。
PyMDFS主要包含以下特征,
在线读取Micaps GDS服务器数据,模式、观测、卫星、雷达等
读写Micaps Diamond数据,读取Micaps网络存储二进制格式数据
读取卫星产品数据 (AWX)
读取天气雷达拼图数据 (.LATLON)
过滤站点和经纬度裁剪
主要的数据结构为`pandas.DataFrame <https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html>`_ 和 xarray.DataArray
README
安装方法
使用 pip 可以直接安装
pip install pymdfs
简单上手
从 Micaps GDS 服务器中读取数据
pymdfs 中最常用的类为 MdfsClient , 它承担了从 GDS 服务器中读取数据和裁剪经纬度的重要功能。
MdfsClient 介绍
实例化 MdfsClient 类时使用 GDS server address and port.
MdfsClient 拉取 GDS 数据的前端接口,通过一下多个参数组合实现其功能,
datasource, GDS 服务器中子类数据的顶级路径
inittime, 数值模式的起报时间或观测数据的观测时间
fh, 模式预报时效(仅针对模式数据)
varname, 变量名, 对应于子类数据路径后移植到最后的数据目录路径,以 / 连接
level, 模式垂直层(仅针对模式数据)
lat, 维度切片
lon, 经度切片
wildcard, 文件名通配符,如未提供此参数,程序将自动解析,但将增加运行时间
以下程序,使用 MdfsClient 拉取 0.125度的 ECWMF 在北京时间2023年2月20日20时起报的未来24小时的相对湿度。
from datetime import datetime
from pymdfs import MdfsClient
gds = MdfsClient('xxx.xxx.xxx.xxx:xxxx')
dar = gds.sel('ECMWF_HR', datetime(2023, 2, 20, 20), fh=24, varname='RH',
level=850, lat=slice(20, 40), lon=slice(110, 130))
print(dar)
以下程序,使用 MdfsClient 拉取2023年2月20日20时观测的24小时站点降水量, 并过滤出北纬20-40度、东经110-130度范围的站点数据,数据结构为 pandas.DataFrame
from datetime import datetime
from pymdfs import MdfsClient
gds = MdfsClient('xxx.xxx.xxx.xxx:xxxx')
df = gds.sel('SURFACE', datetime(2023, 2, 20, 20), varname='RAIN24_ALL_STATION',
lat=slice(20, 40), lon=slice(110, 130))
print(df)
命令行程序
1. client_query
- 用法:
mdfs_query [-h] [-s SERVER] [-o LOGLEVEL] datasource
MDFS数据变量查询
- 位置参数:
datasource 数据名称
- 可选参数:
arguments
Description
-h, –help
show this help message and exit
-s SERVER, –server SERVER
GDS server address
-o LOGLEVEL, –loglevel LOGLEVEL
loglevel: 10, 20, 30, 40, 50
示例:
mdfs_query ECMWF_HR
2. client_dump
- 用法:
mdfs_dump [-h] [-f FH] [-e OUTFILE] [-c COMPLEVEL] [-v VARNAME] [-x LON] [-y LAT] [-p LEVEL] [-t OFFSET_INITTIME] [–name_map NAME_MAP] [-s SERVER] [-o LOGLEVEL] datasource inittime
MDFS数据读取下载
- 位置参数:
arguments
Description
datasource
data source name
inittime
model initial datetime or observation datetime
- 可选参数:
arguments
Description
-h, –help
show this help message and exit
-f FH, –fh FH
model forecast hour
-e OUTFILE, –outfile OUTFILE
output netcdf file name
-c COMPLEVEL, –complevel COMPLEVEL
output netcdf4 compress level
-v VARNAME, –varname VARNAME
model variable names
-x LON, –lon LON
longitude point or range
-y LAT, –lat LAT
latitude point or range
-p LEVEL, –level LEVEL
pressure level point or range
-t OFFSET_INITTIME, –offset-inittime OFFSET_INITTIME
offset inittime (hours) to variable
–name_map NAME_MAP
map variable name to new
-s SERVER, –server SERVER
GDS server address
-o LOGLEVEL, –loglevel LOGLEVEL
logger level in number
示例:
以下脚本使用 client_dump 命令行程序,拉取ECMWF 2023年2月19日20时起报的24小时预报时效, 500hPa的相对湿度、U/V风场、温度场、高度场的数据,并存储为 ECMWF_HR.2023021920.nc 文件。
mdfs_dump ECMWF_HR 2023021920 -f 24 --level 500 -v RH,UGRD,VGRD,TMP,HGT -e ECMWF_HR.2023021920.nc
更多细节和特征,请参与项目文档 readthedocs .
Metadata
Release files for pymdfs 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pymdfs-0.1.1.tar.gz | 47.7 kB | Without provenance | Details for pymdfs-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymdfs-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pymdfs-0.1.1-py3-none-any.whl |
Total release size: 117.9 kB
Release files / pymdfs-0.1.1.tar.gz
| Download URL | pymdfs-0.1.1.tar.gz |
|---|---|
| Size | 47.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97241297378a8099779f87725d717b2b60b6576675252522c226f6b08ecb162f
|
|
BLAKE2b-256 checksum How to use checksums |
a81e2168b9e8f435eb2fe8dad4f94ef559c14e8bb766dbdbe2815049d3229be4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.16
|
Release files / pymdfs-0.1.1-py3-none-any.whl
| Download URL | pymdfs-0.1.1-py3-none-any.whl |
|---|---|
| Size | 70.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea674dfb622451d78fc3bd463285b91d351b8261dca5abbd5586c14f6fbc5a83
|
|
BLAKE2b-256 checksum How to use checksums |
4db0989d91e9ed6380288ef11803ec5bf8e38de08cd5636c646648e45981d1c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.16
|
Security for pymdfs 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.