{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# A3. Loading AP Sensing files\n", "This example loads AP sensing files. Only single-ended files are currently supported. Just like with Silixa's devices, the AP Sensing data is in .xml files" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2022-04-06T08:12:29.520519Z", "iopub.status.busy": "2022-04-06T08:12:29.519679Z", "iopub.status.idle": "2022-04-06T08:12:31.215962Z", "shell.execute_reply": "2022-04-06T08:12:31.215351Z" } }, "outputs": [], "source": [ "import os\n", "import glob\n", "\n", "from dtscalibration import read_apsensing_files" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The example data files are located in `./python-dts-calibration/tests/data`." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2022-04-06T08:12:31.219744Z", "iopub.status.busy": "2022-04-06T08:12:31.219507Z", "iopub.status.idle": "2022-04-06T08:12:31.225338Z", "shell.execute_reply": "2022-04-06T08:12:31.224123Z" } }, "outputs": [], "source": [ "filepath = os.path.join(\"..\", \"..\", \"tests\", \"data\", \"ap_sensing\")\n", "print(filepath)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2022-04-06T08:12:31.254656Z", "iopub.status.busy": "2022-04-06T08:12:31.254433Z", "iopub.status.idle": "2022-04-06T08:12:31.259760Z", "shell.execute_reply": "2022-04-06T08:12:31.258995Z" } }, "outputs": [], "source": [ "filepathlist = sorted(glob.glob(os.path.join(filepath, \"*.xml\")))\n", "filenamelist = [os.path.basename(path) for path in filepathlist]\n", "\n", "for fn in filenamelist:\n", " print(fn)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will simply load in the .xml files" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2022-04-06T08:12:31.262782Z", "iopub.status.busy": "2022-04-06T08:12:31.262491Z", "iopub.status.idle": "2022-04-06T08:12:31.692953Z", "shell.execute_reply": "2022-04-06T08:12:31.692317Z" } }, "outputs": [], "source": [ "ds = read_apsensing_files(directory=filepath)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The object tries to gather as much metadata from the measurement files as possible (temporal and spatial coordinates, filenames, temperature probes measurements). All other configuration settings are loaded from the first files and stored as attributes of the `xarray.Dataset`.\n", "\n", "Calibration follows as usual (see the other notebooks)." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2022-04-06T08:12:31.695872Z", "iopub.status.busy": "2022-04-06T08:12:31.695622Z", "iopub.status.idle": "2022-04-06T08:12:31.706049Z", "shell.execute_reply": "2022-04-06T08:12:31.705163Z" } }, "outputs": [], "source": [ "print(ds)" ] } ], "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.9.11" } }, "nbformat": 4, "nbformat_minor": 2 }