Python interface for the JMA's NuSDaS format
Project description
pynus
A python library enabling to handle files in the NuSDaS format operationally used in the NWP systems in JMA.
You will find Japanese readme below.
Usage
Install using pip
I like the name "pynus", but this library is distibuted as "pynusdas" package in PyPI.
pip install pynusdas
Feed a NuSDaS file and get full xarray Datasets
decode_nusdas function returns you fully loaded xarray Datasets. This is handy when you want to simply convert the entire dataset into netcdf.
from pynus import decode_nusdas
mdls, surfs = decode_nusdas(f"./data/fcst_mdl.nus/ZSSTD1/200910070000")
mdls.to_netcdf(f"./data/MF10km_MDLL_200910070000.nc")
surfs.to_netcdf(f"./data/MF10km_SURF_200910070000.nc")
Lazy-loading with xarray using pynus as an engine
You can also use xr.open_dataset function with specifying engine='pynus' or engine='pynusdas'. More suitable when you handle a dataset intreactively e.g. in jupyter notebook.
mdls = xr.open_dataset(f"./data/fcst_mdl.nus/ZSSTD1/200910070000",
engine="pynus", chunks={"x": 19, "y": 17},)
print(mdls)
Disclaimer
This library is NOT an official project of JMA. Don't send any inquiries to JMA regarding this project.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgement
This work is inspired and partly coming from by the tutorial codes on the Laboratory of Meteorology website at Hokkaido University.
https://geodynamics.sci.hokudai.ac.jp/humet/meteo/tutorial.html
Japanese
pynusは気象庁の現業気象予報システムで使用されているNuSDaSフォーマットで記述されたファイルをpythonで簡便に読み込むことを目的としたライブラリです。
使いかた
PyPIでは "pynusdas" パッケージとして登録されているため以下のコマンドでインストールできます。
pip install pynusdas
NuSDaSファイルを丸ごと読み込む
decode_nusdas 関数にNuSDaSファイルのパスを渡すことで全ての変数をxarray datasetとして読み込みます。返されるデータセットは地上と大気成分に別れた2つのデータセットです。この関数はnetcdf形式への変換などデータセット全体に対し作業するときに便利です。
from pynus import decode_nusdas
mdls, surfs = decode_nusdas(f"./data/fcst_mdl.nus/ZSSTD1/200910070000")
mdls.to_netcdf(f"./data/MF10km_MDLL_200910070000.nc")
surfs.to_netcdf(f"./data/MF10km_SURF_200910070000.nc")
xarray.open_datasetを用いて逐次読み込む
xr.open_dataset関数の引数にengine="pynus"またはengine="pynusdas"を指定することでnetcdfファイルの読み込みと同じ感覚で作業することも可能です。Jupyter notebookでの描画などデータのごく一部のみを逐次読み出すときに便利です。
mdls = xr.open_dataset(f"./data/fcst_mdl.nus/ZSSTD1/200910070000",
engine="pynus", chunks={"x": 19, "y": 17},)
print(mdls)
免責事項
このライブラリの開発は気象庁および関連機関の業務とは一切関係がございません。気象庁および関係者の方へのこのライブラリに関する問い合わせはお控えください。
謝辞
ライブラリのコードは北海道大学気象学研究室のチュートリアルをベースにさせていただきました。ここに感謝を申し上げます。
https://geodynamics.sci.hokudai.ac.jp/humet/meteo/tutorial.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pynusdas-0.0.5.tar.gz.
File metadata
- Download URL: pynusdas-0.0.5.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a097de03ba57ddb19b8a6ed10669e0ff1a216dc8439d6b58b3bec54dba0a35c
|
|
| MD5 |
e16c62967b1e45cc5f4d3a9918652cdf
|
|
| BLAKE2b-256 |
b881357ab6dcd61e8b03fceacefa3cd27aa6988e59dd016274734fce23be9695
|
File details
Details for the file pynusdas-0.0.5-py3-none-any.whl.
File metadata
- Download URL: pynusdas-0.0.5-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc646ff2e30cfe2c1999c3adbc5981bf5e1de4154adcffd41944d7043a4df67f
|
|
| MD5 |
ddf030e8317f5ab91b1a35389c48a795
|
|
| BLAKE2b-256 |
78d64f3580040cba0550e359f9a487cc5bfb566c95bd2be53d64bd4f7491ee4b
|