Skip to content

changes to comp_z - #1562

Open
dopplerchase wants to merge 7 commits into
ARM-DOE:mainfrom
dopplerchase:composite_z_fix
Open

changes to comp_z#1562
dopplerchase wants to merge 7 commits into
ARM-DOE:mainfrom
dopplerchase:composite_z_fix

Conversation

@dopplerchase

Copy link
Copy Markdown
Contributor

Code for issue #1559, where composite reflectivity code carried artifacts through with poor quality radar data from velocity sweeps. I also made a change to the interpolator because it was flagged as depreciated (e.g., scipy.interpolate.interp2d).

This is now open for comment from the maintainers! Happy to make changes as needed.

Example usage:

compz = pyart.retrieve.composite_reflectivity(radar, field="reflectivity")

image

The code is flexible, and allows you to still have the old functionality through the simple bool:

compz = pyart.retrieve.composite_reflectivity(radar, field="reflectivity",same_nyquist=False)

image

@dopplerchase
dopplerchase requested a review from zssherman as a code owner April 15, 2024 16:53
@zssherman

Copy link
Copy Markdown
Collaborator

@dopplerchase Thanks for the PR! The errors seem to be PEP8 fixes.

Comment thread pyart/retrieve/comp_z.py Outdated
Comment thread pyart/retrieve/comp_z.py Outdated


def composite_reflectivity(radar, field="reflectivity", gatefilter=None):
def composite_reflectivity(radar, field="reflectivity", gatefilter=None,same_nyquist=True,nyquist_vector_idx=0):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space between between the comment and same_

Comment thread pyart/retrieve/comp_z.py Outdated
During a volume scan (i.e., file) the PRF (nyqust velocity) can change.
This can create some odd artifacts at times with if data quality is low on certain scans.
To get around this, you can change the code to only take the max of scans with the same nyquist +/- 1 m/s.
Defult this will be on (True), but folks can turn this off.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defult to Default

Comment thread pyart/retrieve/comp_z.py Outdated
This can create some odd artifacts at times with if data quality is low on certain scans.
To get around this, you can change the code to only take the max of scans with the same nyquist +/- 1 m/s.
Defult this will be on (True), but folks can turn this off.
nyquist_vector_idx: int

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space around colon

Comment thread pyart/retrieve/comp_z.py Outdated

# Apply the interpolation
z = z_interpolator(ranges, azimuth_final)
z = z_interpolator(azimuth_final,ranges)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after comma

Comment thread pyart/retrieve/comp_z.py Outdated
# if first sweep, create new dim, otherwise concat them up
if sweep == minimum_sweep:
z_stack = copy.deepcopy(z[np.newaxis, :, :])
nyquist_stack = copy.deepcopy(nyquist[np.newaxis,:])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after comma

Comment thread pyart/retrieve/comp_z.py Outdated
elevation,
instrument_parameters=instrument_parameters,
)
) No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove no newline

@mgrover1

Copy link
Copy Markdown
Collaborator

@dopplerchase - is there anything we can do to help here?

@dopplerchase

Copy link
Copy Markdown
Contributor Author

@mgrover1 find me some more time? lol We need to think carefully about Ryan's comments noted on #1559

@mgrover1

Copy link
Copy Markdown
Collaborator

no worries 😄 that is a good point!!

@decadeneo

Copy link
Copy Markdown

I'm glad to hear that someone has encountered a similar bug. When directly using the function pyart.retrieve.composite_reflectivity, I found that the interpolated composite reflectivity values are all NaN. Upon diving into the source code, I was prompted to change the interpolation method. However, when attempting to modify it with alternative interpolation methods, I encountered an error indicating that the number of azimuth angles per layer in my radar data is inconsistent, thereby preventing a smooth interpolation process.

@zssherman

Copy link
Copy Markdown
Collaborator

@mgrover1 I'm seeing the testing fail due to the depreciation of interp2d, we might need to do a PR just with the depreciation change. I can work on that.

Removed conflicting code related to z interpolator configuration and application.
@RBhupi
RBhupi requested a review from zssherman July 3, 2026 23:59
@RBhupi

RBhupi commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

It is failing multiple test on my local machine.
Merging main into composite_z_fix commit to auto-triggers CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Composite Z bugs (issue and fix)

5 participants