{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# 1. Load your first measurement files\n", "\n", "The goal of this notebook is to show the different options of loading measurements from raw DTS files. These files are loaded into a `xarray.Dataset` object. This object has various methods for calibration, plotting. Both single-ended and double-ended measurements are supported. The current supported devices are:\n", "- Silixa\n", "- Sensornet\n", "- AP Sensing\n", "- Sensortran\n", "\n", "See notebooks A2, A3, and A4." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2022-04-06T08:08:46.789383Z", "iopub.status.busy": "2022-04-06T08:08:46.788536Z", "iopub.status.idle": "2022-04-06T08:08:48.302357Z", "shell.execute_reply": "2022-04-06T08:08:48.301753Z" } }, "outputs": [], "source": [ "import os\n", "import glob\n", "\n", "from dtscalibration import read_silixa_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:08:48.304968Z", "iopub.status.busy": "2022-04-06T08:08:48.304776Z", "iopub.status.idle": "2022-04-06T08:08:48.308162Z", "shell.execute_reply": "2022-04-06T08:08:48.307655Z" } }, "outputs": [], "source": [ "filepath = os.path.join(\"..\", \"..\", \"tests\", \"data\", \"double_ended2\")\n", "print(filepath)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2022-04-06T08:08:48.331334Z", "iopub.status.busy": "2022-04-06T08:08:48.331164Z", "iopub.status.idle": "2022-04-06T08:08:48.335864Z", "shell.execute_reply": "2022-04-06T08:08:48.335260Z" } }, "outputs": [], "source": [ "# Bonus: Just to show which files are in the folder\n", "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": [ "Define in which timezone the measurements are taken. In this case it is the timezone of the Silixa Ultima computer was set to 'Europe/Amsterdam'. The default timezone of netCDF files is `UTC`. All the steps after loading the raw files are performed in this timezone. Please see www..com for a full list of supported timezones. We also explicitely define the file extension (`.xml`) because the folder is polluted with files other than measurement files." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2022-04-06T08:08:48.338116Z", "iopub.status.busy": "2022-04-06T08:08:48.337960Z", "iopub.status.idle": "2022-04-06T08:08:48.648874Z", "shell.execute_reply": "2022-04-06T08:08:48.648058Z" } }, "outputs": [], "source": [ "ds = read_silixa_files(directory=filepath, timezone_netcdf=\"UTC\", file_ext=\"*.xml\")" ] }, { "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 `DataStore`." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2022-04-06T08:08:48.652000Z", "iopub.status.busy": "2022-04-06T08:08:48.651697Z", "iopub.status.idle": "2022-04-06T08:08:48.676716Z", "shell.execute_reply": "2022-04-06T08:08:48.675872Z" } }, "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.10.10" } }, "nbformat": 4, "nbformat_minor": 2 }