Skip to content

Commit

Permalink
removed all PEP8 messages
Browse files Browse the repository at this point in the history
  • Loading branch information
winash12 committed Nov 9, 2023
1 parent 4845074 commit 2eac3f3
Showing 1 changed file with 37 additions and 47 deletions.
84 changes: 37 additions & 47 deletions src/metpy/calc/kinematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,13 +1434,14 @@ def geospatial_laplacian(f, *, dx=None, dy=None, x_dim=-1, y_dim=-2,
return divergence(grad_u, grad_y, dx=dx, dy=dy, x_dim=x_dim, y_dim=y_dim,
parallel_scale=parallel_scale, meridional_scale=meridional_scale)


@exporter.export
@parse_grid_arguments
@check_units(vortmask='[speed]',dx='[length]', dy='[length]')
def rotational_wind_from_inversion(vortmask,*,dx,dy,x_ll_subset,x_ur_subset,
y_ll_subset,y_ur_subset,x_ll,x_ur,y_ll,y_ur):
@check_units(vortmask='[speed]', dx='[length]', dy='[length]')
def rotational_wind_from_inversion(vortmask, *, dx, dy, x_ll_subset, x_ur_subset,
y_ll_subset, y_ur_subset, x_ll, x_ur, y_ll, y_ur):
r"""Calculate reconstructed rotational wind field from vorticity

Check failure on line 1443 in src/metpy/calc/kinematics.py

View workflow job for this annotation

GitHub Actions / Flake8

[flake8] reported by reviewdog 🐶 D205 1 blank line required between summary line and description Raw Output: src/metpy/calc/kinematics.py:1443:5: D205 1 blank line required between summary line and description

Check failure on line 1443 in src/metpy/calc/kinematics.py

View workflow job for this annotation

GitHub Actions / Flake8

[flake8] reported by reviewdog 🐶 D400 First line should end with a period Raw Output: src/metpy/calc/kinematics.py:1443:5: D400 First line should end with a period
vortmask : 'xarray DataArray' subset of the original vorticity for the entire globe
vortmask : 'xarray DataArray' subset of the original vorticity for the entire globe
dx : `pint.Quantity`,required
The grid spacing(s) in the x-direction. If an array, there should be one item less than
the size of `u` along the applicable axis. Optional if `xarray.DataArray` with
Expand All @@ -1463,40 +1464,35 @@ def rotational_wind_from_inversion(vortmask,*,dx,dy,x_ll_subset,x_ur_subset,
y_ur : int, required upper right latitude index of the inner bounding box
"""
dx1 = dx.magnitude

dy1 = dy.magnitude

vortmask1 = vortmask.values

for i in range(x_ll_subset, x_ur_subset):


for j in range(y_ur_subset, y_ll_subset):

iindex[:,:] = i
jindex[:,:] = j
xdiff = (iindex-xindex)*dx1[y_ur:y_ll,x_ll:x_ur]
ydiff = (jindex-yindex)*dy1[y_ur:y_ll,x_ll:x_ur]
for j in range(y_ur_subset, y_ll_subset):
iindex[:, :] = i

Check failure on line 1471 in src/metpy/calc/kinematics.py

View workflow job for this annotation

GitHub Actions / Flake8

[flake8] reported by reviewdog 🐶 F821 Undefined name `iindex` Raw Output: src/metpy/calc/kinematics.py:1471:13: F821 Undefined name `iindex`
jindex[:, :] = j

Check failure on line 1472 in src/metpy/calc/kinematics.py

View workflow job for this annotation

GitHub Actions / Flake8

[flake8] reported by reviewdog 🐶 F821 Undefined name `jindex` Raw Output: src/metpy/calc/kinematics.py:1472:13: F821 Undefined name `jindex`
xdiff = (iindex - xindex) * dx1[y_ur:y_ll, x_ll:x_ur]

Check failure on line 1473 in src/metpy/calc/kinematics.py

View workflow job for this annotation

GitHub Actions / Flake8

[flake8] reported by reviewdog 🐶 F821 Undefined name `iindex` Raw Output: src/metpy/calc/kinematics.py:1473:22: F821 Undefined name `iindex`

Check failure on line 1473 in src/metpy/calc/kinematics.py

View workflow job for this annotation

GitHub Actions / Flake8

[flake8] reported by reviewdog 🐶 F821 Undefined name `xindex` Raw Output: src/metpy/calc/kinematics.py:1473:31: F821 Undefined name `xindex`
ydiff = (jindex - yindex) * dy1[y_ur:y_ll, x_ll:x_ur]

Check failure on line 1474 in src/metpy/calc/kinematics.py

View workflow job for this annotation

GitHub Actions / Flake8

[flake8] reported by reviewdog 🐶 F821 Undefined name `jindex` Raw Output: src/metpy/calc/kinematics.py:1474:22: F821 Undefined name `jindex`

Check failure on line 1474 in src/metpy/calc/kinematics.py

View workflow job for this annotation

GitHub Actions / Flake8

[flake8] reported by reviewdog 🐶 F821 Undefined name `yindex` Raw Output: src/metpy/calc/kinematics.py:1474:31: F821 Undefined name `yindex`
rsq = xdiff * xdiff + ydiff * ydiff
upsi[j,i] = np.where(rsq > 0., vortmask1[y_ur:y_ll,x_ll:x_ur]*-1.0*(ydiff/rsq)*dx1[y_ur:y_ll,x_ll:x_ur]*dy1[y_ur:y_ll,x_ll:x_ur], 0.0).sum()
vpsi[j,i] = np.where(rsq > 0., vortmask1[y_ur:y_ll,x_ll:x_ur]*(xdiff/rsq)*dx1[y_ur:y_ll,x_ll:x_ur]*dy1[y_ur:y_ll,x_ll:x_ur], 0.0).sum()



upsi[j, i] = np.where(rsq > 0., vortmask1[y_ur:y_ll, x_ll:x_ur] * -1.0 * (

Check failure on line 1476 in src/metpy/calc/kinematics.py

View workflow job for this annotation

GitHub Actions / Flake8

[flake8] reported by reviewdog 🐶 F821 Undefined name `upsi` Raw Output: src/metpy/calc/kinematics.py:1476:13: F821 Undefined name `upsi`

Check warning on line 1476 in src/metpy/calc/kinematics.py

View check run for this annotation

Codecov / codecov/patch

src/metpy/calc/kinematics.py#L1466-L1476

Added lines #L1466 - L1476 were not covered by tests
ydiff / rsq) * dx1[y_ur:y_ll, x_ll:x_ur] * dy1[y_ur:y_ll,
x_ll:x_ur], 0.0).sum()
vpsi[j, i] = np.where(rsq > 0., vortmask1[y_ur:y_ll, x_ll:x_ur] * (

Check warning on line 1479 in src/metpy/calc/kinematics.py

View check run for this annotation

Codecov / codecov/patch

src/metpy/calc/kinematics.py#L1479

Added line #L1479 was not covered by tests
xdiff / rsq) * dx1[y_ur:y_ll, x_ll:x_ur] * dy1[y_ur:y_ll,
x_ll:x_ur], 0.0).sum()
upsi[:, :] = (1 / (2 * np.pi)) * upsi[:, :]
vpsi[:, :] = (1 / (2 * np.pi)) * vpsi[:, :]

Check warning on line 1483 in src/metpy/calc/kinematics.py

View check run for this annotation

Codecov / codecov/patch

src/metpy/calc/kinematics.py#L1482-L1483

Added lines #L1482 - L1483 were not covered by tests

upsi[:,:] = (1/(2*np.pi)) * upsi[:,:]
vpsi[:,:] = (1/(2*np.pi)) * vpsi[:,:]
return upsi, vpsi

Check warning on line 1485 in src/metpy/calc/kinematics.py

View check run for this annotation

Codecov / codecov/patch

src/metpy/calc/kinematics.py#L1485

Added line #L1485 was not covered by tests

return upsi,vpsi

@exporter.export
@parse_grid_arguments
@check_units(divmask='[speed]',dx='[length]', dy='[length]')
def divergent_wind_from_inversion(divmask,*,dx,dy,x_ll_subset,x_ur_subset,
y_ll_subset,y_ur_subset,x_ll,x_ur,y_ll,y_ur):
@check_units(divmask='[speed]', dx='[length]', dy='[length]')
def divergent_wind_from_inversion(divmask, *, dx, dy, x_ll_subset, x_ur_subset,
y_ll_subset, y_ur_subset, x_ll, x_ur, y_ll, y_ur):

r"""Calculate reconstructed divergent wind field from divergence
divmask : 'xarray DataArray' subset of the original vorticity for the entire globe
divmask : 'xarray DataArray' subset of the original vorticity for the entire globe
dx : `pint.Quantity`,required
The grid spacing(s) in the x-direction. If an array, there should be one item less than
the size of `u` along the applicable axis. Optional if `xarray.DataArray` with
Expand All @@ -1520,29 +1516,23 @@ def divergent_wind_from_inversion(divmask,*,dx,dy,x_ll_subset,x_ur_subset,
"""

dx1 = dx.magnitude

dy1 = dy.magnitude

divmask1 = divmask.values


for i in range(x_ll_subset, x_ur_subset):


for j in range(y_ur_subset, y_ll_subset):

iindex[:,:] = i
jindex[:,:] = j
xdiff = (iindex-xindex)*dx1[y_ur:y_ll,x_ll:x_ur]
ydiff = (jindex-yindex)*dy1[y_ur:y_ll,x_ll:x_ur]
for j in range(y_ur_subset, y_ll_subset):
iindex[:, :] = i
jindex[:, :] = j
xdiff = (iindex - xindex) * dx1[y_ur:y_ll, x_ll:x_ur]
ydiff = (jindex - yindex) * dy1[y_ur:y_ll, x_ll:x_ur]
rsq = xdiff * xdiff + ydiff * ydiff
uchi[j,i] = np.where(rsq > 0., divmask1[y_ur:y_ll,x_ll:x_ur]*(xdiff/rsq)*dx1[y_ur:y_ll,x_ll:x_ur]*dy1[y_ur:y_ll,x_ll:x_ur], 0.0).sum()
vchi[j,i] = np.where(rsq > 0., divmask1[y_ur:y_ll,x_ll:x_ur]*(ydiff/rsq)*dx1[y_ur:y_ll,x_ll:x_ur]*dy1[y_ur:y_ll,x_ll:x_ur], 0.0).sum()



uchi[j, i] = np.where(rsq > 0., divmask1[y_ur:y_ll, x_ll:x_ur] * (

Check warning on line 1528 in src/metpy/calc/kinematics.py

View check run for this annotation

Codecov / codecov/patch

src/metpy/calc/kinematics.py#L1518-L1528

Added lines #L1518 - L1528 were not covered by tests
xdiff / rsq) * dx1[y_ur:y_ll, x_ll:x_ur] * dy1[y_ur:y_ll,
x_ll:x_ur], 0.0).sum()
vchi[j, i] = np.where(rsq > 0., divmask1[y_ur:y_ll, x_ll:x_ur] * (

Check warning on line 1531 in src/metpy/calc/kinematics.py

View check run for this annotation

Codecov / codecov/patch

src/metpy/calc/kinematics.py#L1531

Added line #L1531 was not covered by tests
ydiff / rsq) * dx1[y_ur:y_ll, x_ll:x_ur] * dy1[y_ur:y_ll,
x_ll:x_ur], 0.0).sum()

uchi[:,:] = (1/(2*np.pi)) * uchi[:,:]
vchi[:,:] = (1/(2*np.pi)) * vchi[:,:]
uchi[:, :] = (1 / (2 * np.pi)) * uchi[:, :]
vchi[:, :] = (1 / (2 * np.pi)) * vchi[:, :]

Check warning on line 1536 in src/metpy/calc/kinematics.py

View check run for this annotation

Codecov / codecov/patch

src/metpy/calc/kinematics.py#L1535-L1536

Added lines #L1535 - L1536 were not covered by tests

return uchi,vchi
return uchi, vchi

Check warning on line 1538 in src/metpy/calc/kinematics.py

View check run for this annotation

Codecov / codecov/patch

src/metpy/calc/kinematics.py#L1538

Added line #L1538 was not covered by tests

0 comments on commit 2eac3f3

Please sign in to comment.