Skip to content

Commit

Permalink
replace intake_fetcher by pooch
Browse files Browse the repository at this point in the history
  • Loading branch information
acocac committed Nov 12, 2023
1 parent b7af4a2 commit 188674d
Showing 1 changed file with 48 additions and 5 deletions.
53 changes: 48 additions & 5 deletions tree-crown-detection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"source": [
"from scivision.catalog import default_catalog\n",
"from scivision.io import load_dataset, load_pretrained_model\n",
"from intake_zenodo_fetcher import download_zenodo_files_for_entry"
"from pooch"
]
},
{
Expand Down Expand Up @@ -606,16 +606,59 @@
"target_datasource"
]
},
{
"cell_type": "markdown",
"source": [
"We use `pooch` to fetch the file from the Zenodo repository."
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading data from 'doi:10.5281/zenodo.5494629/Sep_2014_RGB_602500_646600.tif' to file '/Users/acoca/repo/tree-crown-detection/Sep_2014_RGB_602500_646600.tif'.\n"
]
}
],
"source": [
"file_path = pooch.retrieve(\n",
" url=\"doi:10.5281/zenodo.5494629/Sep_2014_RGB_602500_646600.tif\",\n",
" known_hash=\"md5:77a3b57f5f5946504ec520d1e793f250\",\n",
" path='.',\n",
" fname='Sep_2014_RGB_602500_646600.tif'\n",
")"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "markdown",
"source": [
"Then we use `load_dataset` from `scivision.io`. This will return a `intake.catalog.local.YAMLFileCatalog` with the information of the dataset."
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": 10,
"outputs": [],
"source": [
"cat = load_dataset(target_datasource.url.item()) \n",
"download_zenodo_files_for_entry(cat.sepilok_rgb, force_download=False)\n",
"cat = load_dataset(target_datasource.url.item())\n",
"dataset = cat.sepilok_rgb().to_dask()"
]
],
"metadata": {
"collapsed": false
}
},
{
"attachments": {},
Expand Down

0 comments on commit 188674d

Please sign in to comment.