Skip to main content

Downloader for meteorological and ocean datasets

Project description

1. climdatapy

Publish to PyPI

気象・海洋のデータセットをダウンロードするCLI/Pythonパッケージ。

1.1. 対応データセット

source .climdatarc
JRA3Q NCAR GDEX 詳細
NCEP Reanalysis1 京大生存圏DB 詳細
NCEP Reanalysis2 京大生存圏DB 詳細
OISST NOAA NCEI 詳細
COBESST JMA NEAR-GOOS 詳細
HIMSST JMA NEAR-GOOS 詳細
MGDSST JMA NEAR-GOOS 詳細
OSTIA Copernicus Marine Data Store 詳細 CopernicusMarineUsername,CopernicusMarinePassward
MODIS EATHDATA 詳細 ModisUsername,ModisPassward

各データ使用の際の引用や謝辞等の規定はsourceを参照してください。

1.2. 目次

2. Installation

Python 3.11以上が必要。

pipコマンドを使い、PyPIからインストールする。

$ pip install climdatapy

3. Usage

3.1. CLI

climdataコマンドでデータセットを管理する。

3.1.1. ダウンロード可能データセットを表示

$ climdata list

3.1.2. データセットをダウンロード

(例) 2024年1月1日から1月2日までのJRA3Qデータをダウンロードする。

$ climdata download JRA3Q --start_time 2024-01-01 --end_time 2024-01-02 --out ./JRA3Q --logfile jra3q.log --skip_existing

引数の説明は-hオプションで確認できる。

$ climdata download -h
usage: climdata download [-h] --start_time START_TIME --end_time END_TIME [--out OUT] [--logfile LOGFILE] [--skip_existing] dataset

Download files for a specified dataset and time range.

positional arguments:
  dataset               dataset name

options:
  -h, --help            show this help message and exit
  --start_time START_TIME
                        start date (YYYY-MM-DD)
  --end_time END_TIME   end date (YYYY-MM-DD)
  --out OUT             output directory
  --logfile LOGFILE     logfile path
  --skip_existing       set for ignore existing files

3.1.3. 最新データをダウンロード

(例) 公開されている最新のJRA3Qデータをダウンロードする。

$ climdata update JRA3Q --out ./JRA3Q --logfile jra3q.log --skip_existing

引数の説明は-hオプションで確認できる。

$ climdata update -h
usage: climdata update [-h] [--out OUT] [--logfile LOGFILE] [--skip_existing] dataset

positional arguments:
  dataset            dataset name

options:
  -h, --help         show this help message and exit
  --out OUT          output directory
  --logfile LOGFILE  logfile path
  --skip_existing       set for ignore existing files

3.2. Pythonモジュール

各データセットは、抽象基底クラスclimdata.util.Datasetを継承したデータセット管理クラス(以下、管理クラス)を持つ。

climdatapy.get_manager関数で管理クラスを取得する。

import climdatapy

manager = climdatapy.get_manager("JRA3Q")

3.2.1. dowloadメソッド

任意の時間の範囲、変数などを選択し、ダウンロードする。

(例)

start_time = datetime(2025, 1, 1, 0)
end_time = datetime(2025, 1, 1, 6)
download_kw = {
    "stats_type": ["all"],
    "data_kind": ["all"],
    "near_realtime": ["all"],
    "stats_type": ["all"],
    "std": ["true"],
    "var": ["all"],
}

data_dir = Path("./data_new")
log_file_path = Path("./jra3q.log")

manager.download(
    start_time,
    end_time,
    download_kw,
    data_dir,
    log_file_path,
    exist_ok=True,
)

download_kwはデータセット固有の情報を辞書型で格納する。

詳細は各データセットの説明(doc)を参照。

3.2.2. download_allメソッド

指定できる最大限のdownload_kwdownloadメソッドに与えるwrapper。

3.2.3. updateメソッド

取得できる最新の時刻のデータをダウンロードする。

(例)

manager.update(
    download_kw,
    data_dir,
    log_file_path,
    exist_ok=True,
)

3.2.4. update_allメソッド

指定できる最大限のdownload_kwupdateメソッドに与えるwrapper。

3.3. .climdatarc

一部データのダウンロードに必要なアカウント情報、API keyなどを記述するファイル。

$HOMEに配置する。

以下の変数を必要に応じて記述する。(例: CopernicusMarineUsername=username)

変数名
CopernicusMarineUsername Copernicus Marinのユーザ名
CopernicusMarinePassward Copernicus Marinのパスワード

3.4. サンプルスクリプト

sample/download_JRA3Q.py JRA3Qのダウンロード
sample/update_JRA3Q.py JRA3Qの更新
sample/download_MODIS.py MODISのダウンロード
sample/update_MODIS.py MODISの更新

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

climdatapy-0.5.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

climdatapy-0.5.0-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

Details for the file climdatapy-0.5.0.tar.gz.

File metadata

  • Download URL: climdatapy-0.5.0.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for climdatapy-0.5.0.tar.gz
Algorithm Hash digest
SHA256 1608e063a7ec2e3645b7ec93eacf893a20889fa72957a7e2ce5528c4882de20f
MD5 4fa9d9f5d0202a22b699e6ffe5372951
BLAKE2b-256 cf40b9fdb4d58531e88f3e55fe9e69c9deb050a9ba017f451fbbf4ab90275c78

See more details on using hashes here.

Provenance

The following attestation bundles were made for climdatapy-0.5.0.tar.gz:

Publisher: publish.yml on sotomita/climdatapy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file climdatapy-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: climdatapy-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 37.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for climdatapy-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4366ea0405c44b736508bc63ecbfcbe3c60162c7f8772ddd92febff0271c1aba
MD5 0fe405f246894ce14830200d8eddecc3
BLAKE2b-256 b7fc685d09f35c05c76547157d6712c29713eb312f689d16667a32c36a47c608

See more details on using hashes here.

Provenance

The following attestation bundles were made for climdatapy-0.5.0-py3-none-any.whl:

Publisher: publish.yml on sotomita/climdatapy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page