Skip to content

Commit

Permalink
fix new linting updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrover1 committed Apr 14, 2023
1 parent 794dd64 commit bb7dde8
Show file tree
Hide file tree
Showing 45 changed files with 1 addition and 84 deletions.
1 change: 0 additions & 1 deletion doc/source/blog_posts/2022/TRACER.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,6 @@
"\n",
"\n",
"def calculate_degrees(file_id):\n",
"\n",
" # Read in GOES ABI fixed grid projection variables and constants\n",
" x_coordinate_1d = file_id.variables[\"x\"][:] # E/W scanning angle in radians\n",
" y_coordinate_1d = file_id.variables[\"y\"][:] # N/S elevation angle in radians\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x110792770>"
"<IPython.lib.display.IFrame at 0x111992b00>"
]
},
"execution_count": 1,
Expand Down Expand Up @@ -347,15 +347,13 @@
" right_field=\"reflectivity\",\n",
" plot_config=plot_configuration,\n",
"):\n",
"\n",
" # Read the radar data\n",
" radar = pyart.io.read_nexrad_archive(f\"s3://{file}\")\n",
"\n",
" # Extract the lowest two sweeps - to help with speeding up the data cleaning\n",
" radar = radar.extract_sweeps([0, 1])\n",
"\n",
" if \"velocity\" in [left_field, right_field]:\n",
"\n",
" # Dealias the radial velocities, using a reflectivity threshold to only look at precip regions\n",
" nyq = radar.instrument_parameters[\"nyquist_velocity\"][\"data\"][0]\n",
" gatefilter = pyart.filters.GateFilter(radar)\n",
Expand All @@ -372,7 +370,6 @@
" # Create a plot number to iterate over\n",
" plot_number = 0\n",
" for field in (left_field, right_field):\n",
"\n",
" # Use the configuration for the field\n",
" config = plot_config[field]\n",
"\n",
Expand Down
1 change: 0 additions & 1 deletion examples/plotting/plot_rhi_cfradial.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
nplots = radar.nsweeps

for snum in radar.sweep_number["data"]:

fixed_angle = radar.fixed_angle["data"][snum]
title = "HSRHI Az=%.3f" % (fixed_angle)
ax = fig.add_subplot(nplots, 1, snum + 1)
Expand Down
1 change: 0 additions & 1 deletion pyart/_debug_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,4 @@ def _debug_info(stream=None):


if __name__ == "__main__":

_debug_info()
1 change: 0 additions & 1 deletion pyart/aux_io/gamic_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ def read_gamic(
moment_names = gfile.moment_names(moment_groups)

for moment_name, group in zip(moment_names, moment_groups):

field_name = filemetadata.get_field_name(moment_name)
if field_name is None:
continue
Expand Down
1 change: 0 additions & 1 deletion pyart/core/radar.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ def __init__(
pitch=None,
georefs_applied=None,
):

if "calendar" not in time:
time["calendar"] = "gregorian"
self.time = time
Expand Down
2 changes: 0 additions & 2 deletions pyart/correct/phase_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,6 @@ def LP_solver_cylp(A_Matrix, B_vectors, weights, really_verbose=False):
s.logLevel = 0

for raynum in range(n_rays):

# set new B_vector values for actual ray
s.setRowLowerArray(np.squeeze(np.asarray(B_vectors[raynum])))
# set new weights (objectives) for actual ray
Expand Down Expand Up @@ -1518,7 +1517,6 @@ def get_phidp_unf_gf(
cordata = np.zeros(my_phidp.shape, dtype=float)
all_non_meteo = gatefilter.gate_excluded
for radial in range(my_phidp.shape[0]):

# deterimine non meteo from gatefilter CHANGED
notmeteo = all_non_meteo[radial, :]
x_ma = ma.masked_where(notmeteo, my_phidp[radial, :])
Expand Down
4 changes: 0 additions & 4 deletions pyart/correct/region_dealias.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def dealias_region_based(

# loop over sweeps
for nsweep, sweep_slice in enumerate(radar.iter_slice()):

# extract sweep data
sdata = vdata[sweep_slice].copy() # is a copy needed here?
scorr = data[sweep_slice]
Expand Down Expand Up @@ -365,7 +364,6 @@ def _find_regions(vel, gfilter, limits):
label = np.zeros(vel.shape, dtype=np.int32)
nfeatures = 0
for lmin, lmax in zip(limits[:-1], limits[1:]):

# find connected regions within the limits
inp = (lmin <= vel) & (vel < lmax) & mask
limit_label, limit_nfeatures = ndimage.label(inp)
Expand Down Expand Up @@ -627,7 +625,6 @@ def merge_nodes(self, base_node, merge_node, foo_edge):
self._common_finder[:] = False
edges_in_base = list(self.edges_in_node[base_node])
for edge_num in edges_in_base:

# reverse edge if needed so node_alpha is base_node
if self.node_beta[edge_num] == base_node:
self._reverse_edge_direction(edge_num)
Expand All @@ -640,7 +637,6 @@ def merge_nodes(self, base_node, merge_node, foo_edge):

# loop over edge nodes
for edge_num in edges_in_merge:

# reverse edge so that node alpha is the merge_node
if self.node_beta[edge_num] == merge_node:
self._reverse_edge_direction(edge_num)
Expand Down
3 changes: 0 additions & 3 deletions pyart/io/chl.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ def read_chl(
# fields
fields = {}
for i, fdata in chl_file.fields.items():

field_info = chl_file.field_info[i]
field_name = filemetadata.get_field_name(field_info["name"])
if field_name is None:
Expand Down Expand Up @@ -236,7 +235,6 @@ class ChlFile:
"""

def __init__(self, filename, ns_time=True, debug=False):

# initalize attributes
self.ngates = None
self.num_sweeps = None
Expand Down Expand Up @@ -402,7 +400,6 @@ def _extract_fields(self):
all_data = np.frombuffer(self._dstring, dtype=self._dtype)
all_data = all_data.reshape(-1, self.ngates)
for i, field_num in enumerate(self._field_nums):

fdata = np.ma.masked_values(all_data[all_data.dtype.names[i]], 0)
# apply scale and offset factors to interger data types
if issubclass(fdata.dtype.type, np.integer):
Expand Down
1 change: 0 additions & 1 deletion pyart/io/mdv_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,6 @@ def _get_chunks(self, debug=False):
# the file pointer must be set at the correct location prior to call
radar_info, elevations, calib_info = None, [], None
for cnum, curr_chunk_header in enumerate(self.chunk_headers):

chunk_id = curr_chunk_header["chunk_id"]
self.fileptr.seek(curr_chunk_header["chunk_data_offset"])

Expand Down
3 changes: 0 additions & 3 deletions pyart/io/nexrad_cdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def read_nexrad_cdm(

ray_i = 0
for scan_index, scan_dic in enumerate(scan_info):

var_index = scan_dic["index"][0]
nradials = scan_dic["nradials"][0]

Expand All @@ -155,7 +154,6 @@ def read_nexrad_cdm(
fixed_agl_data[scan_index] = np.mean(dvars[elevation_var][var_index][:nradials])

for i, moment in enumerate(scan_dic["moments"]):

moment_index = scan_dic["index"][i]
m_ngates = scan_dic["ngates"][i]
m_nradials = scan_dic["nradials"][i]
Expand Down Expand Up @@ -321,7 +319,6 @@ def _scan_info(dvars):

for time_var in time_variables:
for time_var_i, time in enumerate(dvars[time_var][:, 0]):

scan_index = scan_start_times.index(time)
scan_dic = scan_info[scan_index]
moment = time_var_to_moment[time_var]
Expand Down
3 changes: 0 additions & 3 deletions pyart/io/uf_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ def write_uf(
)

for ray_num in range(radar.nrays):

ray_bytes = raycreator.make_ray(ray_num)
pad = struct.pack(b">i", raycreator.record_length * 2)

Expand All @@ -135,7 +134,6 @@ def _find_field_mapping(radar, uf_field_names, radar_field_names, exclude_fields

field_mapping = {}
for radar_field in radar.fields.keys():

if radar_field in exclude_fields:
continue

Expand Down Expand Up @@ -330,7 +328,6 @@ def make_ray(self, ray_num):
ray += self.make_field_position()

for field_info in field_positions:

data_type = field_info["data_type"]
offset = field_info["offset_field_header"] + 19
radar_field = field_info["radar_field"]
Expand Down
1 change: 0 additions & 1 deletion pyart/io/uffile.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def __init__(self, filename):
# read in the records, store as a list of rays
self.rays = []
while len(buf) == 8: # read until EOF reached

# record size stored as a 2-byte int start at byte 2
record_size = struct.unpack(">h", buf[padding + 2 : padding + 4])[0] * 2

Expand Down
1 change: 0 additions & 1 deletion pyart/map/gates_to_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def map_gates_to_grid(

# project gates from each radar onto the grid
for radar, gatefilter in zip(radars, gatefilters):

# Copy the field data and masks.
# TODO method that does not copy field data into new array
if nfields == 0:
Expand Down
2 changes: 0 additions & 2 deletions pyart/map/grid_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ def map_to_grid(

# loop over the radars finding gate locations, field data, and offset
for iradar, (radar, gatefilter) in enumerate(zip(radars, gatefilters)):

# calculate radar offset from the origin
x_disp, y_disp = geographic_to_cartesian(
radar.longitude["data"], radar.latitude["data"], projparams
Expand Down Expand Up @@ -652,7 +651,6 @@ def map_to_grid(

# interpolate field values for each point in the grid
for iz, iy, ix in np.ndindex(nz, ny, nx):

# calculate the grid point
x = x_start + x_step * ix
y = y_start + y_step * iy
Expand Down
1 change: 0 additions & 1 deletion pyart/retrieve/_echo_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ def steiner_class_buff(
area_relation,
use_intense,
):

zslice = np.argmin(np.abs(z - work_level))
refl = ze[zslice, :, :]

Expand Down
1 change: 0 additions & 1 deletion pyart/retrieve/advection.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ def grid_shift(grid, advection, trim_edges=0, field_list=None):
field_list = grid.fields.keys()

for field in field_list:

# copy data and fill with nans
data = grid.fields[field]["data"].copy()
data = np.ma.filled(data, np.nan)
Expand Down
1 change: 0 additions & 1 deletion pyart/retrieve/comp_z.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


def composite_reflectivity(radar, field="reflectivity", gatefilter=None):

"""
Composite Reflectivity
Expand Down
7 changes: 0 additions & 7 deletions pyart/retrieve/kdp_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,6 @@ def boundary_conditions_maesaka(
idx_far = np.zeros(radar.nrays, dtype=np.int32)

for ray, regions in enumerate(slices):

# check if all range gates are missing
if regions is None:
continue
Expand All @@ -1543,10 +1542,8 @@ def boundary_conditions_maesaka(

# near range gate boundary condition
for slc in regions:

# check if enough samples exist in slice
if slc.stop - slc.start >= n:

# parse index and range of nearest range gate
idx = slice(slc.start, slc.start + n)
idx_near[ray] = idx.start
Expand All @@ -1571,9 +1568,7 @@ def boundary_conditions_maesaka(

# far range gate boundary condition
for slc in reversed(regions):

if slc.stop - slc.start >= n:

# parse index and range of furthest range gate
idx = slice(slc.stop - n, slc.stop)
idx_far[ray] = idx.stop
Expand Down Expand Up @@ -1604,7 +1599,6 @@ def boundary_conditions_maesaka(

# skip the check if there are no valid values
if kwargs.get("check_outliers", True) and (phi_near_valid.size != 0):

# bin and count near range boundary condition values, i.e., create
# a distribution of values
# the default bin width is 5 deg
Expand Down Expand Up @@ -1651,7 +1645,6 @@ def boundary_conditions_maesaka(
print(f"Estimated system phase offset: {system_phase_offset:.0f} deg")

for ray, bc in enumerate(phi_near):

# if near range boundary condition does not draw from system phase
# distribution then set it to the system phase offset
if bc < left_edge or bc > right_edge:
Expand Down
2 changes: 0 additions & 2 deletions pyart/retrieve/qvp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
def quasi_vertical_profile(
radar, desired_angle=None, fields=None, gatefilter=None, verbose=False
):

"""
Quasi Vertical Profile.
Expand Down Expand Up @@ -78,7 +77,6 @@ def quasi_vertical_profile(
fields = radar.fields

for field in fields:

# Filtering data based on defined gatefilter
# If none is defined goes to else statement
if gatefilter is not None:
Expand Down
1 change: 0 additions & 1 deletion pyart/retrieve/vad.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ def __call__(self, x_new, window=None):

y_new = np.zeros_like(x_new, dtype=self.y_sorted.dtype)
for i, center in enumerate(x_new):

bottom = center - window
top = center + window
start = np.searchsorted(self.x_sorted, bottom)
Expand Down
1 change: 0 additions & 1 deletion pyart/testing/data/check_nexrad_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def test_dummy_similar():


def radars_similar(r1, r2):

###########################
# Attribute that are None #
###########################
Expand Down
1 change: 0 additions & 1 deletion pyart/testing/data/dummify_nexrad_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
# replace all radial data with a single value so it compresses well
pos = 0
while pos < buf_length:

# retrieve the record (msg31)
new_pos, record = nexrad._get_record_from_buf(buf, pos)
if record["header"]["type"] != 31:
Expand Down
4 changes: 0 additions & 4 deletions pyart/util/columnsect.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def for_azimuth(radar_latitude, target_latitude, radar_longitude, target_longitu


def get_field_location(radar, latitude, longitude):

"""
Given the location (in latitude, longitude) of a target, extract the
radar column above that point for further analysis.
Expand Down Expand Up @@ -276,7 +275,6 @@ def get_field_location(radar, latitude, longitude):


def get_column_rays(radar, azimuth):

"""
Given the location (in latitude,longitude) of a target, return the rays
that correspond to radar column above the target.
Expand Down Expand Up @@ -329,7 +327,6 @@ def get_column_rays(radar, azimuth):


def check_latitude(latitude):

"""
Function to check if input latitude is valid for type and value.
Expand All @@ -356,7 +353,6 @@ def check_latitude(latitude):


def check_longitude(longitude):

"""
Function to check if input latitude is valid for type and value.
Expand Down
1 change: 0 additions & 1 deletion pyart/util/radar_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ def join_radar(radar1, radar2):
== 1 & len(radar2.altitude["data"])
== 1
):

lat1 = float(radar1.latitude["data"])
lon1 = float(radar1.longitude["data"])
alt1 = float(radar1.altitude["data"])
Expand Down
1 change: 0 additions & 1 deletion scripts/anytocfradial
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import argparse
import pyart

if __name__ == "__main__":

# parse the arguments
parser = argparse.ArgumentParser(
description="Convert a radar file to CF/Radial format."
Expand Down
Loading

0 comments on commit bb7dde8

Please sign in to comment.