Skip to content

Commit

Permalink
Merge branch 'main' into auto-read
Browse files Browse the repository at this point in the history
  • Loading branch information
syedhamidali authored Oct 29, 2024
2 parents 6d878bd + be4730e commit 162828e
Show file tree
Hide file tree
Showing 50 changed files with 3,210 additions and 895 deletions.
62 changes: 61 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
python -c "import xradar; print(xradar.version.version)"
- name: Test with pytest
run: |
pytest -n auto --dist loadfile --verbose --durations=15 --cov-report xml:coverage_notebook.xml --cov=xradar --pyargs examples/notebooks
pytest -n auto --dist loadscope --verbose --durations=15 --cov-report xml:coverage_notebook.xml --cov=xradar --pyargs examples/notebooks
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
Expand All @@ -125,6 +125,66 @@ jobs:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN}}

build_2:
name: xarray nightly tests - linux
runs-on: ubuntu-latest
needs: [ lint ]
continue-on-error: true
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: [ "3.12" ]
numpy-version: [ "2" ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install micromamba environment
uses: mamba-org/setup-micromamba@v1
with:
environment-name: xradar-unit-tests
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
create-args: >-
python=${{matrix.python-version}}
cmweather
dask
fsspec
h5netcdf
h5py
lat_lon_parser
netCDF4
open-radar-data>=0.3.0
packaging
pandas
pip
pyproj
pytest
pytest-doctestplus
pytest-sugar
pytest-xdist
scipy
setuptools
wheel
xmltodict
numpy=${{matrix.numpy-version}}
conda
- name: Install xarray
run: |
python -m pip install --no-deps --ignore-installed --no-cache-dir -vvv \
git+https://github.com/pydata/xarray.git@main
- name: Install xradar
run: |
python -m pip install --no-deps .
- name: Version Info
run: |
python -c "import xradar; print(xradar.version.version)"
- name: Test with pytest
run: |
pytest -n auto --dist loadscope --verbose --durations=15 --pyargs tests
test_build_distribution_testpypi:
name: test build distribution for testpypi
Expand Down
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
cff-version: 1.0.3
message: If you use this software, please cite it using these metadata.
# FIXME title as repository name might not be the best name, please make human readable
title: 'openradar/xradar: xradar v0.6.0'
title: 'openradar/xradar: xradar v0.7.0'
doi: 10.5281/zenodo.7091737
# FIXME splitting of full names is error prone, please check if given/family name are correct
authors:
Expand Down Expand Up @@ -36,7 +36,7 @@ authors:
affiliation: Federal Office of Meteorology and Climatology MeteoSwiss
orcid: https://orcid.org/0009-0006-1419-0556

version: 0.6.0
date-released: 2024-08-05
version: 0.7.0
date-released: 2024-10-26
repository-code: https://github.com/openradar/xradar
license: MIT
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022-2023, Open Radar Community Developers
Copyright (c) 2022-2024, Open Radar Community Developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 1 addition & 2 deletions ci/notebooktests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ dependencies:
- pytest-xdist
- scipy
- setuptools
- xarray
- xarray-datatree>=0.0.10
- xarray>=2024.10.0
- xmltodict
- boto3
- arm_pyart
Expand Down
3 changes: 1 addition & 2 deletions ci/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ dependencies:
- pytest-xdist
- scipy
- setuptools
- xarray
- xarray-datatree>=0.0.10
- xarray>=2024.10.0
- xmltodict
16 changes: 14 additions & 2 deletions docs/history.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# History

## Development Version
## 0.8.0 (2024-10-28)

This is the first version which uses datatree directly from xarray. Thus, xarray is pinned to version >= 2024.10.0.

* ADD: Added new module `transform` for transforming CF1 data to CF2 and vice versa ({pull}`224`) by [@syedhamidali](https://github.com/syedhamidali).
* Use DataTree from xarray and add xarray nightly run ({pull}`213`, {pull}`214`, {pull}`215`, {pull}`218`) by [@kmuehlbauer](https://github.com/kmuehlbauer).
* ADD: Added new accessor `map_over_sweeps` for volume operations on DataTrees and a matching decorator ({pull}`203`) by [@syedhamidali](https://github.com/syedhamidali).


## 0.7.0 (2024-10-26)

This is the last version which uses datatree from xarray-contrib/datatree. Thus, xarray is pinned to version 2024.9.0.

* ADD: Added `apply_to_sweeps` function for applying custom operations to all sweeps in a `DataTree` radar volume Implemented by [@syedhamidali](https://github.com/syedhamidali), ({pull}`202`).
* ADD: Metek Micro Rain Radar 2 reader by [@rcjackson](https://github.com/rcjackson), ({pull}`200`) by [@rcjackson](https://github.com/rcjackson).

## 0.6.5 (2024-09-20)

Expand All @@ -16,7 +28,7 @@

## 0.6.3 (2024-08-13)

FIX: use rstart in meter for ODIM_H5/V2_4 ({issue}`196`) by [@kmuehlbauer](https://github.com/kmuehlbauer), ({pull}`197`) by [@kmuehlbauer](https://github.com/kmuehlbauer).
* FIX: use rstart in meter for ODIM_H5/V2_4 ({issue}`196`) by [@kmuehlbauer](https://github.com/kmuehlbauer), ({pull}`197`) by [@kmuehlbauer](https://github.com/kmuehlbauer).

## 0.6.2 (2024-08-12)

Expand Down
4 changes: 4 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ datamodel
importers
exporters
notebooks/Accessors
notebooks/Mapping_Sweeps
```

```{toctree}
Expand All @@ -28,11 +29,14 @@ notebooks/Auto_Read
notebooks/CfRadial1_Model_Transformation
notebooks/CfRadial1
notebooks/CfRadial1_Export
notebooks/Transform
notebooks/ODIM_H5
notebooks/GAMIC
notebooks/Furuno
notebooks/Rainbow
notebooks/Iris
notebooks/HaloPhotonics
notebooks/MRR
notebooks/NexradLevel2
notebooks/Read-plot-Sigmet-data-from-AWS
notebooks/plot-ppi
Expand Down
5 changes: 2 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- nodefaults
dependencies:
- python >=3.9,<3.12
- python >=3.10,<3.13
- pydata-sphinx-theme
- pip
- myst-parser
Expand All @@ -18,8 +18,7 @@ dependencies:
- netCDF4
- open-radar-data>=0.1.0
- pyproj
- xarray
- xarray-datatree>=0.0.10
- xarray>=2024.10.0
- xmltodict
- cartopy
- cmweather
Expand Down
9 changes: 5 additions & 4 deletions examples/notebooks/CfRadial1_Export.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"outputs": [],
"source": [
"import cmweather # noqa\n",
"import datatree as xt\n",
"import xarray as xr\n",
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
Expand Down Expand Up @@ -138,7 +138,8 @@
"outputs": [],
"source": [
"def ref_filter(dtree, sweep=\"sweep_0\", field=\"DBZ\"):\n",
" ds = dtree[sweep].where((dtree[sweep][field] >= -10) & (dtree[sweep][field] <= 70))\n",
" ds = dtree[sweep].ds\n",
" ds = ds.where((ds[field] >= -10) & (ds[field] <= 70))\n",
" red_patch = ds.where(\n",
" (\n",
" (ds[field] >= ds[field].max().values - 0.5)\n",
Expand Down Expand Up @@ -189,13 +190,13 @@
"outputs": [],
"source": [
"# Initialize an empty DataTree\n",
"result_tree = xt.DataTree()\n",
"result_tree = xr.DataTree()\n",
"\n",
"for sweep in radar.sweep_group_name.values:\n",
" corrected_data = ref_filter(radar, sweep, field=\"DBZ\")\n",
"\n",
" # Convert the xarray Dataset to a DataTree and add it to the result_tree\n",
" data_tree = xt.DataTree.from_dict(corrected_data.to_dict())\n",
" data_tree = xr.DataTree.from_dict(corrected_data.to_dict())\n",
"\n",
" # Copy the contents of data_tree into result_tree\n",
" for key, value in data_tree.items():\n",
Expand Down
5 changes: 2 additions & 3 deletions examples/notebooks/CfRadial1_Model_Transformation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"source": [
"import os\n",
"\n",
"import datatree as xt\n",
"import xarray as xr\n",
"from open_radar_data import DATASETS\n",
"\n",
Expand Down Expand Up @@ -474,7 +473,7 @@
"metadata": {},
"outputs": [],
"source": [
"dtree2 = xt.open_datatree(outfile)\n",
"dtree2 = xr.open_datatree(outfile)\n",
"with xr.set_options(display_expand_data_vars=True, display_expand_attrs=True):\n",
" display(dtree2)"
]
Expand Down Expand Up @@ -539,7 +538,7 @@
"metadata": {},
"outputs": [],
"source": [
"dtree4 = xt.open_datatree(\"test_cfradial2.nc\")\n",
"dtree4 = xr.open_datatree(\"test_cfradial2.nc\")\n",
"with xr.set_options(display_expand_data_vars=True, display_expand_attrs=True):\n",
" display(dtree4)"
]
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/HaloPhotonics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"source": [
"fig, ax = plt.subplots(3, 3, figsize=(12, 10))\n",
"for sweep in range(9):\n",
" sweep_ds = xd.georeference.get_x_y_z(ds[\"sweep_%d\" % sweep])\n",
" sweep_ds = xd.georeference.get_x_y_z(ds[\"sweep_%d\" % sweep].ds)\n",
" sweep_ds = sweep_ds.set_coords([\"x\", \"y\", \"z\", \"time\", \"range\"])\n",
" sweep_ds[\"mean_doppler_velocity\"].plot(\n",
" x=\"x\", y=\"y\", ax=ax[int(sweep / 3), sweep % 3]\n",
Expand Down
Loading

0 comments on commit 162828e

Please sign in to comment.