intake - 摄入缓存指定文件名/位置
问题描述
我正在尝试使用intake
和intake-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
相反,我在我的主目录中得到了一些东西。
我是否错误地指定了缓存目录?
作为第二个问题:是否可以直接指定缓存文件在保存时应如何调用?
谢谢!保罗
解决方案
缓存的位置由配置指定,该配置通常是一个 YAML 文件~/.intake/conf.yaml
(键“cache_dir”),但可以根据INTAKE_CONF(_FILE)
环境变量或源的元数据,键“catalog_dir”(<- 这可能不正确?)。特殊值“catdir”表示“在目录所在的目录中”。
然而
随着缓存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 中还没有所需的更改。
推荐阅读
- r - R:通过将多个值与一个值进行比较来创建瀑布图
- node.js - 根据条件从集合中删除所有文档并创建缺失的文档
- android - 如何在Android上的本机lib文件夹中提取二进制可执行文件
- asp.net-core - 如何以编程方式设置 Blazor 组件的布局?
- cmd - 是否可以从命令行而不是 gui 使用 trace 32 功能?
- azure - 我们可以将 Azure SQL 数据库部署到专用虚拟网络吗?为什么?
- java - Java create Customer 函数给出随机值
- react-hooks - 在 useEffect 中设置状态后无法渲染状态变量
- java - 空参数 java 空指针
- google-apps-script - 如何在 Google Apps 脚本中获取日历活动的开始和结束时间?