Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD: Auto Read Function #205

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ notebooks/Mapping_Sweeps
:maxdepth: 2
:caption: Examples

notebooks/Auto_Read
notebooks/CfRadial1_Model_Transformation
notebooks/CfRadial1
notebooks/CfRadial1_Export
Expand Down
246 changes: 246 additions & 0 deletions examples/notebooks/Auto_Read.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "0",
"metadata": {},
"source": [
"# Auto read with Xradar"
]
},
{
"cell_type": "markdown",
"id": "1",
"metadata": {},
"source": [
"### Description"
]
},
{
"cell_type": "markdown",
"id": "2",
"metadata": {},
"source": [
"This notebook demonstrates how to automatically read various radar data formats using the xradar library. The examples cover multiple radar file formats, showing how xradar handles and organizes the data into DataTree structures. Each dataset showcases a specific radar format, presenting detailed metadata, dimensions, coordinates, and data variables for each radar type.\n",
"\n",
"Available Features:\n",
"\n",
"- **Georeferencing (default: True)**: Automatically adds cartesian coordinates (x, y, z) to the radar data for easier analysis. This feature can be disabled by setting `georeference=False`.\n",
"\n",
"- **Verbose Mode (default: False)**: Enables detailed logging when `verbose=True`, including debug-level information about the file reading process, format attempts, and georeferencing steps.\n",
"\n",
"- **Timeout**: The `timeout` parameter allows you to set a time limit for reading radar files. If the reading process gets stuck or runs indefinitely, a `TimeoutException` is raised, preventing the process from hanging and ensuring smooth operation."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3",
"metadata": {},
"outputs": [],
"source": [
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
"cell_type": "markdown",
"id": "4",
"metadata": {},
"source": [
"## CF/Radial"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"metadata": {},
"outputs": [],
"source": [
"filename = DATASETS.fetch(\"cfrad.20080604_002217_000_SPOL_v36_SUR.nc\")\n",
"radar = xd.io.read(filename)\n",
"radar"
]
},
{
"cell_type": "markdown",
"id": "6",
"metadata": {},
"source": [
"## ODIM_H5"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"metadata": {},
"outputs": [],
"source": [
"filename = DATASETS.fetch(\"71_20181220_060628.pvol.h5\")\n",
"radar = xd.io.read(filename)\n",
"radar"
]
},
{
"cell_type": "markdown",
"id": "8",
"metadata": {},
"source": [
"## GAMIC"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"metadata": {},
"outputs": [],
"source": [
"filename = DATASETS.fetch(\"DWD-Vol-2_99999_20180601054047_00.h5\")\n",
"radar = xd.io.read(filename)\n",
"radar"
]
},
{
"cell_type": "markdown",
"id": "10",
"metadata": {},
"source": [
"## Furuno"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "11",
"metadata": {},
"outputs": [],
"source": [
"filename_scn = DATASETS.fetch(\"0080_20210730_160000_01_02.scn.gz\")\n",
"radar = xd.io.read(filename_scn)\n",
"radar"
]
},
{
"cell_type": "markdown",
"id": "12",
"metadata": {},
"source": [
"## Rainbow"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "13",
"metadata": {},
"outputs": [],
"source": [
"filename = DATASETS.fetch(\"2013051000000600dBZ.vol\")\n",
"radar = xd.io.read(filename)\n",
"radar"
]
},
{
"cell_type": "markdown",
"id": "14",
"metadata": {},
"source": [
"## Iris/Sigmet - Reader"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "15",
"metadata": {},
"outputs": [],
"source": [
"filename_single = DATASETS.fetch(\"SUR210819000227.RAWKPJV\")\n",
"radar = xd.io.read(filename_single)\n",
"radar"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "16",
"metadata": {},
"outputs": [],
"source": [
"filename_volume = DATASETS.fetch(\"cor-main131125105503.RAW2049\")\n",
"radar = xd.io.read(filename_volume)\n",
"radar"
]
},
{
"cell_type": "markdown",
"id": "17",
"metadata": {},
"source": [
"## NEXRAD Level 2"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18",
"metadata": {},
"outputs": [],
"source": [
"filename = DATASETS.fetch(\"KATX20130717_195021_V06\")\n",
"radar = xd.io.read(filename)\n",
"radar"
]
},
{
"cell_type": "markdown",
"id": "19",
"metadata": {},
"source": [
"## Other available options"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "20",
"metadata": {},
"outputs": [],
"source": [
"help(xd.io.read)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "21",
"metadata": {},
"outputs": [],
"source": [
"filename = DATASETS.fetch(\"cfrad.20080604_002217_000_SPOL_v36_SUR.nc\")\n",
"radar = xd.io.read(filename, verbose=True)\n",
"print(radar.attrs[\"comment\"])"
]
}
],
"metadata": {
"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.12.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading