Skip to content

Commit

Permalink
ADD: Add in recent changes from main branch to 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrover1 committed Dec 16, 2024
2 parents 3d3fc1e + cbe4fb7 commit 685a0c9
Show file tree
Hide file tree
Showing 37 changed files with 162 additions and 2,851 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
python -m pytest -v --cov=./ --cov-report=xml
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v5.1.1
uses: codecov/codecov-action@v2.1.0
with:
file: ./coverage.xml
flags: unittests
Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ The required dependencies to install Py-ART in addition to Python are:
* `Cython <https://cython.readthedocs.io/en/latest/>`_
* `setuptools <https://setuptools.pypa.io/en/latest/index.html>`_
* `cartopy <https://scitools.org.uk/cartopy/docs/latest/>`_
* `cmweather <https://cmweather.readthedocs.io/en/latest/>`_
* `cartopy <https://scitools.org.uk/cartopy/docs/latest/>`_

A working C/C++ compiler is required for some optional modules. An easy method
to install these dependencies is by using a
Expand Down
5 changes: 3 additions & 2 deletions continuous_integration/environment-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ dependencies:
- libnetcdf
- flake8
- fsspec
- s3fs
- glpk
- cftime
- setuptools
- shapely
- ruff
- ruff==0.4.2
- mda-xdrlib
- xradar>=0.8.0
- pooch
- versioneer
- black
- open-radar-data
- ruff
- cmweather
5 changes: 4 additions & 1 deletion doc/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
- cartopy
- cvxopt
- xarray>=2024.10.0
- sphinx==7.1.2
- sphinx<7.2==7.1.2
- ipython
- pandoc
- pkg-config
Expand All @@ -34,6 +34,9 @@ dependencies:
- pre_commit
- cmweather
- mda-xdrlib
- xradar
- cmweather
- mda-xdrlib
- xradar>=0.8.0
- dask
- ablog
Expand Down
4 changes: 2 additions & 2 deletions doc/source/blog_posts/2022/hail-analysis-spc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
" ax=ax,\n",
" embellish=False,\n",
" add_grid_lines=True,\n",
" cmap=\"pyart_ChaseSpectral\",\n",
" cmap=\"ChaseSpectral\",\n",
" vmin=-20,\n",
" vmax=70,\n",
")\n",
Expand Down Expand Up @@ -1064,7 +1064,7 @@
" projection=projection,\n",
" resolution=\"10m\",\n",
" gatefilter=gatefilter,\n",
" cmap=\"pyart_ChaseSpectral\",\n",
" cmap=\"ChaseSpectral\",\n",
" colorbar_flag=False,\n",
" lat_lines=[0, 0],\n",
" lon_lines=[0, 0],\n",
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies:
- xradar
- mda-xdrlib
- pip
- cmweather
- pip:
- wheel
- watchdog
Expand Down
4 changes: 2 additions & 2 deletions examples/mapping/plot_compare_two_radars_gatemapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
disp1 = pyart.graph.RadarMapDisplay(radar_se)
disp1.plot_ppi_map(
"reflectivity_bias",
cmap="pyart_balance",
cmap="balance",
title="Reflectivity Difference \n XSAPR Southwest - XSPAR Southeast",
sweep=1,
ax=ax,
Expand Down Expand Up @@ -216,7 +216,7 @@

# Create a 1-1 comparison
x, y = np.meshgrid((bins[:-1] + bins[1:]) / 2.0, (bins[:-1] + bins[1:]) / 2.0)
c = plt.pcolormesh(x, y, np.log10(hist.T), cmap="pyart_HomeyerRainbow")
c = plt.pcolormesh(x, y, np.log10(hist.T), cmap="HomeyerRainbow")

# Add a colorbar and labels
plt.colorbar(c, label="$log_{10}$ counts")
Expand Down
16 changes: 6 additions & 10 deletions examples/plotting/plot_choose_a_colormap.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
######################################
# **Plot the available colormaps**
#
# Let's see which colormaps are available directly from Py-ART!
# Let's see which colormaps are available in Py-ART from the colormap package cmweather!
# We use a helper function from matplotlib to plot this.

# Setup some helper functions and ranges to visualize our colormaps, from matplotlib
Expand All @@ -40,11 +40,11 @@ def plot_color_gradients(cmap_category, cmap_list):
axs[0].set_title(cmap_category + " Colormaps", fontsize=14)

for ax, cmap_name in zip(axs, cmap_list):
ax.imshow(gradient, aspect="auto", cmap=f"pyart_{cmap_name}")
ax.imshow(gradient, aspect="auto", cmap=f"{cmap_name}")
ax.text(
-0.01,
0.5,
f"pyart_{cmap_name}",
f"{cmap_name}",
va="center",
ha="right",
fontsize=10,
Expand Down Expand Up @@ -158,14 +158,10 @@ def plot_color_gradients(cmap_category, cmap_list):
######################################
# **Plot Using a Colormap from Py-ART**
#
# Let's use one of our Py-ART's colorbars now! We need
# to remember to add the pyart_ string in front of the
# colormap, as shown below.
# Let's use one of our cmweather's colorbars now!
# Setup a display to plot the data

display = pyart.graph.RadarDisplay(radar)

# Start by plotting a regular matplotlib colormap (Spectral_r)
display.plot(
"reflectivity_horizontal", vmin=-32, vmax=64.0, cmap="pyart_HomeyerRainbow"
)
# Now let's plot with a CVD-friendly colormap (HomeyerRainbow)
display.plot("reflectivity_horizontal", vmin=-32, vmax=64.0, cmap="HomeyerRainbow")
4 changes: 2 additions & 2 deletions examples/plotting/plot_cross_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
display.plot_grid(
"corrected_reflectivity_horizontal",
ax=ax1,
cmap="pyart_HomeyerRainbow",
cmap="HomeyerRainbow",
vmin=-20,
vmax=70,
)
Expand All @@ -72,7 +72,7 @@
start,
end,
x_axis="lat",
cmap="pyart_HomeyerRainbow",
cmap="HomeyerRainbow",
vmin=-20,
vmax=70,
)
4 changes: 2 additions & 2 deletions examples/plotting/plot_modify_colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
vmax=60,
embellish=False,
norm=None,
cmap="pyart_HomeyerRainbow",
cmap="HomeyerRainbow",
)

# Add gridlines
Expand Down Expand Up @@ -100,7 +100,7 @@
vmax=60,
embellish=False,
norm=None,
cmap="pyart_HomeyerRainbow",
cmap="HomeyerRainbow",
)

# Add gridlines
Expand Down
4 changes: 1 addition & 3 deletions examples/plotting/plot_ppi_mdv.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
display = pyart.graph.RadarDisplay(radar)
fig = plt.figure(figsize=[5, 5])
ax = fig.add_subplot(111)
display.plot(
"reflectivity", 0, vmin=-16.0, vmax=64, title="PPI", cmap="pyart_HomeyerRainbow"
)
display.plot("reflectivity", 0, vmin=-16.0, vmax=64, title="PPI", cmap="HomeyerRainbow")
display.set_limits(ylim=[-150, 150], xlim=[-150, 150])
plt.show()
2 changes: 1 addition & 1 deletion examples/plotting/plot_rhi_cfradial_singlescan.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
mask_outside=True,
title="RHI",
axislabels=(xlabel, ylabel),
cmap="pyart_HomeyerRainbow",
cmap="HomeyerRainbow",
colorbar_label=colorbar_label,
ax=ax,
)
Expand Down
5 changes: 1 addition & 4 deletions examples/plotting/plot_rhi_data_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
ax = fig.add_subplot(111)

# plot velocity
# cmap is the color ramp being used in this case blue to red no 18
# https://github.com/ARM-DOE/pyart/blob/master/pyart/graph/cm.py
# for more information

display.plot(
"velocity",
Expand All @@ -41,7 +38,7 @@
vmax=20.0,
fig=fig,
ax=ax,
cmap="pyart_BuDRd18",
cmap="balance",
colorbar_label="Velocity (m/s)",
)

Expand Down
2 changes: 1 addition & 1 deletion examples/plotting/plot_rhi_two_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# Fields to plot and ranges
fields_to_plot = ["reflectivity_horizontal", "mean_doppler_velocity"]
ranges = [(-20, 20), (-17.0, 17.0)]
cmaps = ["pyart_HomeyerRainbow", "pyart_balance"]
cmaps = ["HomeyerRainbow", "balance"]

# Plot the data
nplots = len(fields_to_plot)
Expand Down
6 changes: 3 additions & 3 deletions examples/plotting/plot_three_panel_gridmapdisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
vmax=vmax,
ax=ax1,
projection=projection,
cmap="pyart_HomeyerRainbow",
cmap="HomeyerRainbow",
)
display.plot_crosshairs(lon=lon, lat=lat)

# Panel 2: longitude slice
ax2 = fig.add_axes(x_cut_panel_axes)
display.plot_longitude_slice(
"REF", lon=lon, lat=lat, ax=ax2, vmin=vmin, vmax=vmax, cmap="pyart_HomeyerRainbow"
"REF", lon=lon, lat=lat, ax=ax2, vmin=vmin, vmax=vmax, cmap="HomeyerRainbow"
)

ax2.set_ylim([0, 15])
Expand All @@ -65,7 +65,7 @@
# Panel 3: latitude slice
ax3 = fig.add_axes(y_cut_panel_axes)
display.plot_latitude_slice(
"REF", lon=lon, lat=lat, ax=ax3, vmin=vmin, vmax=vmax, cmap="pyart_HomeyerRainbow"
"REF", lon=lon, lat=lat, ax=ax3, vmin=vmin, vmax=vmax, cmap="HomeyerRainbow"
)
ax3.set_ylim([0, 15])
ax3.set_xlim([-50, 50])
Expand Down
14 changes: 7 additions & 7 deletions examples/plotting/radar-cross-section.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"display.plot_grid(\n",
" \"corrected_reflectivity_horizontal\",\n",
" ax=ax1,\n",
" cmap=\"pyart_HomeyerRainbow\",\n",
" cmap=\"HomeyerRainbow\",\n",
" vmin=-20,\n",
" vmax=70,\n",
")\n",
Expand All @@ -100,7 +100,7 @@
" start,\n",
" end,\n",
" x_axis=\"lat\",\n",
" cmap=\"pyart_HomeyerRainbow\",\n",
" cmap=\"HomeyerRainbow\",\n",
" vmin=-20,\n",
" vmax=70,\n",
")"
Expand Down Expand Up @@ -168,7 +168,7 @@
" start,\n",
" end,\n",
" x_axis=\"lon\",\n",
" cmap=\"pyart_HomeyerRainbow\",\n",
" cmap=\"HomeyerRainbow\",\n",
" vmin=-20,\n",
" vmax=70,\n",
")"
Expand Down Expand Up @@ -299,7 +299,7 @@
"ds.corrected_reflectivity_horizontal.isel(z=0).plot(\n",
" x=\"lon\",\n",
" y=\"lat\",\n",
" cmap=\"pyart_HomeyerRainbow\",\n",
" cmap=\"HomeyerRainbow\",\n",
" vmin=-20,\n",
" vmax=60,\n",
" ax=ax,\n",
Expand All @@ -320,7 +320,7 @@
"fig = plt.figure()\n",
"ax = plt.subplot(111)\n",
"ds.corrected_reflectivity_horizontal.isel(z=0).plot(\n",
" x=\"lon\", y=\"lat\", cmap=\"pyart_HomeyerRainbow\", vmin=-20, vmax=60, ax=ax\n",
" x=\"lon\", y=\"lat\", cmap=\"HomeyerRainbow\", vmin=-20, vmax=60, ax=ax\n",
")\n",
"ax.scatter(start[1], start[0], label=\"Start Point\", color=\"tab:blue\")\n",
"ax.scatter(end[1], end[0], label=\"Start Point\", color=\"k\")\n",
Expand Down Expand Up @@ -348,7 +348,7 @@
"fig = plt.figure(figsize=(10, 8))\n",
"title = r\"($^\\circ$N)\"\n",
"cross.corrected_reflectivity_horizontal.plot(\n",
" cmap=\"pyart_HomeyerRainbow\",\n",
" cmap=\"HomeyerRainbow\",\n",
" x=None,\n",
" y=\"z\",\n",
" vmin=-20,\n",
Expand Down Expand Up @@ -439,7 +439,7 @@
" grid, \"corrected_reflectivity_horizontal\", start, end\n",
")\n",
"cross.corrected_reflectivity_horizontal.plot(\n",
" cmap=\"pyart_HomeyerRainbow\",\n",
" cmap=\"HomeyerRainbow\",\n",
" x=None,\n",
" y=\"z\",\n",
" vmin=-20,\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/retrieve/plot_composite_reflectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
ax2 = plt.subplot(122)
composite_display = pyart.graph.RadarDisplay(compz)
composite_display.plot(
"composite_reflectivity", ax=ax2, vmin=-20, vmax=80, cmap="pyart_HomeyerRainbow"
"composite_reflectivity", ax=ax2, vmin=-20, vmax=80, cmap="HomeyerRainbow"
)
5 changes: 5 additions & 0 deletions pyart/aux_io/gamic_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ def read_gamic(
Radar object.
"""
warnings.warn(
"Py-ART's GAMIC module is deprecated, please use xradar to read in the file using "
"xd.io.open_gamic_datatree",
UserWarning,
)
# check that h5py is available
if not _H5PY_AVAILABLE:
raise MissingOptionalDependency(
Expand Down
6 changes: 6 additions & 0 deletions pyart/aux_io/odim_h5.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import datetime
import warnings

import numpy as np

Expand Down Expand Up @@ -106,6 +107,11 @@ def read_odim_h5(
# * support for other objects (SCAN, XSEC)

# check that h5py is available
warnings.warn(
"Py-ART's ODIM module is deprecated, please use xradar to read in the file using "
"xd.io.open_odim_datatree",
UserWarning,
)
if not _H5PY_AVAILABLE:
raise MissingOptionalDependency(
"h5py is required to use read_odim_h5 but is not installed"
Expand Down
7 changes: 6 additions & 1 deletion pyart/aux_io/rainbow_wrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# specific modules for this function
import os
import warnings

try:
import wradlib # noqa
Expand Down Expand Up @@ -126,7 +127,11 @@ def read_rainbow_wrl(
Radar object containing data from RAINBOW file.
"""

warnings.warn(
"Py-ART's Rainbow module is deprecated, please use xradar to read in the file using "
"xd.io.open_rainbow_datatree",
UserWarning,
)
# check that wradlib is available
if not _WRADLIB_AVAILABLE:
raise MissingOptionalDependency(
Expand Down
Loading

0 comments on commit 685a0c9

Please sign in to comment.