Skip to content

rpkgs/ecmwfr2

Repository files navigation

ecmwfr2

Goals

Submit ERA5 downloading tasks in batch and download them with modern parallel downloading tool aria2c.

解决cdsapi的问题:

  • 不能并行提交任务

  • 单线程下载速度过慢

实现思路

  • 先提交所有任务

  • 写一个死循环,不断刷新和下载数据,直到所有任务完成

    # 见examples
    Rscript.exe download.R
  • aria2c并行下载,跑满30M(CUG网络)

Installation

remotes::install_github("rpkgs/ecmwfr2")

Usage

授权

  1. 登陆下面的网址,即可显示api key,形式如下:

    https://cds.climate.copernicus.eu/api-how-to

    url: https://cds.climate.copernicus.eu/api/v2
    key: 12106:faa165eb-2d80-4843-9c80-2d5e90adf***
  2. 将api保存至~/.cdsapirc

Examples

  • 1. 下载1959-2021 ERA5 hourly地表气象数据

    library(ecmwfr2)
    login()
    # ecmwfr::wf_set_key(user, key, service = "cds") # second option
    
    param <- list(
      product_type = "reanalysis",
      format = "netcdf",
      variable = c("2m_dewpoint_temperature", "2m_temperature", "skin_temperature"),
      time = c("00:00", "06:00", "12:00", "18:00"),
      year = c("2010"),
      month = sprintf("%02d", 1:12),
      day = sprintf("%02d", 1:31)
    )
    
    dsname = "reanalysis-era5-single-levels"
    
    vars <- c(
      "2m_temperature",
      "2m_dewpoint_temperature",
      "skin_temperature"
    )
    
    # c_request(param, dsname)
    down_vars(vars, param, dsname)

Known issues

  1. keyring 授权不适用于wsl

About

No description, website, or topics provided.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published