1+ <tool id =" xarray_import_data" name =" Xarray Import Data" version =" 0.1.0" profile =" 22.05" >
2+ <description >
3+ Import a dataset from an OPeNDAP URL and convert it to a local NetCDF file using xarray.
4+ </description >
5+ <requirements >
6+ <requirement type =" package" version =" 2025.4.0" >xarray</requirement >
7+ <requirement type =" package" version =" 3" >python</requirement >
8+ <requirement type =" package" version =" 1.6.0" >netcdf4</requirement >
9+ </requirements >
10+ <command detect_errors =" exit_code" ><![CDATA[
11+ python '$__tool_directory__/xarray_import_data.py' '$opendap_url' '$decode_times' '$decode_cf' '$output_dataset'
12+ ]]> </command >
13+ <inputs >
14+ <param name =" opendap_url" type =" text" format =" netcdf" label =" OPeNDAP URL"
15+ help =" OPeNDAP URL to a dataset, also see https://docs.xarray.dev/en/stable/user-guide/io.html#opendap"
16+ optional =" false" >
17+ <validator type =" regex" message =" Type a valid url" >^(https:|http:|\.)\S*</validator >
18+ </param >
19+ <param name =" decode_times" type =" boolean" label =" Decode times"
20+ help =" If true, decode time variables to datetime objects. If false, keep them as raw data."
21+ checked =" true" />
22+ <param name =" decode_cf" type =" boolean" label =" Decode CF conventions"
23+ help =" Whether to decode according to CF conventions"
24+ checked =" true" />
25+ </inputs >
26+ <outputs >
27+ <data name =" output_dataset" from_work_dir =" xarray_imported_data" format =" netcdf"
28+ label =" xarray dataset" />
29+ </outputs >
30+ <tests >
31+ <test >
32+ <param name =" opendap_url"
33+ value =" http://test.opendap.org:8080/opendap/catalog/data/nc/data.nc" />
34+ <output name =" output_dataset" ftype =" netcdf" >
35+ <assert_contents >
36+ <has_size min =" 17K" max =" 18K" />
37+ </assert_contents >
38+ </output >
39+ </test >
40+ </tests >
41+ <help ><![CDATA[
42+ ==================
43+ Xarray Import Data
44+ ==================
45+
46+ **What it does**
47+
48+ Open a dataset from an OPeNDAP URL and convert it to a NetCDF file using xarray and netcdf4.
49+
50+ |
51+
52+ **How to use it**
53+
54+ Pass a valid OPeNDAP URL to the `opendap_url` parameter. The tool will download the dataset and save it as a local NetCDF file.
55+
56+ For big datasets consider subsetting the dataset in the url using `<URL>?var_name1[start:step:end],var_name2[start:step:end]`
57+
58+ |
59+
60+ **Links**
61+ https://docs.xarray.dev/en/stable/user-guide/io.html#opendap
62+ https://www.opendap.org/
63+ ]]>
64+ </help >
65+ <citations >
66+ <citation type =" doi" >10.5334/jors.148</citation >
67+ </citations >
68+ </tool >
0 commit comments