{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Extract the data from .zidv bundles into Python xarray " ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "def load_from_zidv(url=None,outdir=None):\n", "\n", " assert url.startswith('http:'),'only urls supported at this time'\n", " remote_file=request.urlopen(url)\n", " alldata=[]\n", " with ZipFile(BytesIO(remote_file.read())) as zip_file:\n", " for contained_file in zip_file.namelist():\n", " if str(contained_file).startswith('data_'):\n", " data=xr.open_dataset(zip_file.extract(contained_file,outdir))\n", " alldata.append(data)\n", "\n", " return xr.merge(alldata)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.5" } }, "nbformat": 4, "nbformat_minor": 2 }