-
Notifications
You must be signed in to change notification settings - Fork 269
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
changes to comp_z #1562
base: main
Are you sure you want to change the base?
changes to comp_z #1562
Conversation
@dopplerchase Thanks for the PR! The errors seem to be PEP8 fixes. |
@@ -9,11 +9,12 @@ | |||
from netCDF4 import num2date | |||
from pandas import to_datetime | |||
from scipy.interpolate import interp2d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old import should be removed
|
||
from pyart.core import Radar | ||
|
||
|
||
def composite_reflectivity(radar, field="reflectivity", gatefilter=None): | ||
def composite_reflectivity(radar, field="reflectivity", gatefilter=None,same_nyquist=True,nyquist_vector_idx=0): |
There was a problem hiding this comment.
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_
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defult to Default
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space around colon
|
||
# Apply the interpolation | ||
z = z_interpolator(ranges, azimuth_final) | ||
z = z_interpolator(azimuth_final,ranges) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after comma
|
||
# 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,:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after comma
@@ -190,4 +214,4 @@ def composite_reflectivity(radar, field="reflectivity", gatefilter=None): | |||
azimuth, | |||
elevation, | |||
instrument_parameters=instrument_parameters, | |||
) | |||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove no newline
@dopplerchase - is there anything we can do to help here? |
no worries 😄 that is a good point!! |
I'm glad to hear that someone has encountered a similar bug. When directly using the function |
@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. |
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")
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)