【问题标题】:Intake Cache specify filename/location摄入缓存指定文件名/位置
【发布时间】:2020-07-01 13:44:28
【问题描述】:

我正在尝试使用intakeintake-xarray 打开和存储远程文件。我这里有一个最小化的目录文件:

/isibhv/projects/paleo_pool/boundary_conditions/ice_sheet_reconstructions/ice_sheet_reconstructions.yaml

看起来像这样:

metadata:
  version: 1
sources:
  glac1d:
    description: The GLAC-1D Reconstruction 
    driver: netcdf
    args:
        urlpath: "https://sharebox.lsce.ipsl.fr/index.php/s/yfuUw91ruuJXroC/download?path=%2F&files=TOPicemsk.GLACD26kN9894GE90227A6005GGrBgic.nc"
    cache_dir: "{{ CATALOG_DIR }}/glac1d"
    cache: 
        - argkey: urlpath
          type: file

我可以用 Python 打开文件:

import intake
cat = intake.open_catalog("ice_sheet_reconstructions.yaml")
ds = cat.glac1d.read()

这一切都非常有效;我得到了我期望的文件。但是,缓存没有显示在我期望的位置。我猜想在下面创建了一个新文件夹:

/isibhv/projects/paleo_pool/boundary_conditions/ice_sheet_reconstructions/glac1d

相反,我在我的主目录中得到了一些东西。

是不是我指定的缓存目录有误?

作为第二个问题:是否可以直接指定缓存文件在保存时应该如何调用?

谢谢! 保罗

【问题讨论】:

    标签: intake


    【解决方案1】:

    缓存的位置由配置指定,它是一个 YAML 文件,通常在 ~/.intake/conf.yaml(键“cache_dir”)中,但可以根据 INTAKE_CONF(_FILE) 环境变量或源的元数据在其他地方,键“catalog_dir”(

    然而

    随着caching in fsspec的出现,以下将成为可能:

    sources:
      glac1d:
        description: The GLAC-1D Reconstruction 
        driver: netcdf
        args:
            urlpath: "filecache://sharebox.lsce.ipsl.fr/index.php/s/yfuUw91ruuJXroC/download?path=%2F&files=TOPicemsk.GLACD26kN9894GE90227A6005GGrBgic.nc"
            storage_options:
                target_protocol: https
                cache_storage: "{{ CATALOG_DIR }}/glac1d"
    

    不幸的是,intake-xarray 中还没有所需的更改。

    【讨论】:

    猜你喜欢
    • 2012-05-23
    • 2018-11-02
    • 2013-05-29
    • 1970-01-01
    • 1970-01-01
    • 2010-11-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多