Skip to content

Latest commit

 

History

History
85 lines (55 loc) · 1.56 KB

README.md

File metadata and controls

85 lines (55 loc) · 1.56 KB

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