diff --git a/docs/history.md b/docs/history.md index c6621283..72bdc128 100644 --- a/docs/history.md +++ b/docs/history.md @@ -1,5 +1,9 @@ # History +## Development version (unreleased) + +* FIX: Add history to cfradial1 output, and fix minor error in CfRadial1_Export.ipynb notebook({pull}`132`) by [@syedhamidali](https://github.com/syedhamidali) + ## 0.4.0 (2023-09-27) * ENH: Add cfradial1 exporter ({issue}`124`) by [@syedhamidali](https://github.com/syedhamidali), ({pull}`126`) by [@syedhamidali](https://github.com/syedhamidali) @@ -9,6 +13,7 @@ * MIN: use `cmweather` colormaps in xradar ({pull}`128`) by [@kmuehlbauer](https://github.com/kmuehlbauer). ## 0.3.0 (2023-07-11) + * ENH: Add new examples using radar data on AWS s3 bucket ({pull}`102`) by [@aladinor](https://github.com/aladinor) * FIX: Correct DB_DBTE8/DB_DBZE8 and DB_DBTE16/DB_DBZE16 decoding for iris-backend ({pull}`110`) by [@kmuehlbauer](https://github.com/kmuehlbauer) * FIX: Cast boolean string to int in rainbow dictionary ({pull}`113`) by [@egouden](https://github.com/egouden) diff --git a/examples/notebooks/CfRadial1_Export.ipynb b/examples/notebooks/CfRadial1_Export.ipynb index 3bf7eea1..8cf6ae51 100644 --- a/examples/notebooks/CfRadial1_Export.ipynb +++ b/examples/notebooks/CfRadial1_Export.ipynb @@ -62,7 +62,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Plot Range vs. Time" + "### Plot Azimuth vs. Range" ] }, { @@ -74,6 +74,24 @@ "radar.sweep_0.DBZ.plot(cmap=\"ChaseSpectral\", vmin=-10, vmax=70)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Plot Time vs. Range" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "radar.sweep_0.DBZ.swap_dims({\"azimuth\": \"time\"}).sortby(\"time\").plot(\n", + " cmap=\"ChaseSpectral\", vmin=-10, vmax=70\n", + ")" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/xradar/io/export/cfradial1.py b/xradar/io/export/cfradial1.py index 683986c7..400d844b 100644 --- a/xradar/io/export/cfradial1.py +++ b/xradar/io/export/cfradial1.py @@ -27,6 +27,8 @@ "to_cfradial1", ] +from importlib.metadata import version + import numpy as np import xarray as xr @@ -304,6 +306,11 @@ def to_cfradial1(dtree=None, filename=None, calibs=True): dataset.attrs = dtree.attrs + dataset.attrs["Conventions"] = "Cf/Radial" + dataset.attrs["version"] = "1.2" + xradar_version = version("xradar") + dataset.attrs["history"] += f": xradar v{xradar_version} CfRadial1 export" + if filename is None: time = str(dataset.time[0].dt.strftime("%Y%m%d_%H%M%S").values) filename = f"cfrad1_{dataset.instrument_name}_{time}.nc" diff --git a/xradar/model.py b/xradar/model.py index 6f0ab3a0..5a91a30a 100644 --- a/xradar/model.py +++ b/xradar/model.py @@ -290,6 +290,16 @@ ("receiver_slope_vc", None), ("receiver_slope_hx", None), ("receiver_slope_vx", None), + ("k_squared_water", None), + ("i0_dbm_hc", None), + ("i0_dbm_vc", None), + ("i0_dbm_hx", None), + ("i0_dbm_vx", None), + ("dynamic_range_db_hc", None), + ("dynamic_range_db_vc", None), + ("dynamic_range_db_hx", None), + ("dynamic_range_db_vx", None), + ("dbz_correction", None), ] )