Skip to content

Commit

Permalink
Merge pull request #170 from csdms/mcflugen/remove-lint
Browse files Browse the repository at this point in the history
Remove lint
  • Loading branch information
mcflugen authored Oct 3, 2024
2 parents 9ef61a0 + 0df203d commit da1f83d
Show file tree
Hide file tree
Showing 20 changed files with 116 additions and 109 deletions.
1 change: 1 addition & 0 deletions pymt/component/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
100.0
>>> comp.finalize()
"""

import warnings

import yaml
Expand Down
42 changes: 21 additions & 21 deletions pymt/component/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def raster_node_coordinates(shape, spacing=None, origin=None):
>>> from pymt.component.grid import raster_node_coordinates
>>> (y, x) = raster_node_coordinates((2, 3))
>>> y
array([[ 0., 0., 0.],
[ 1., 1., 1.]])
array([[0., 0., 0.],
[1., 1., 1.]])
>>> x
array([[ 0., 1., 2.],
[ 0., 1., 2.]])
array([[0., 1., 2.],
[0., 1., 2.]])
>>> (x, ) = raster_node_coordinates((3, ), (2., ), (1., ))
>>> x
array([ 1., 3., 5.])
array([1., 3., 5.])
"""
spacing = spacing or np.ones_like(shape, dtype=float)
origin = origin or np.zeros_like(shape, dtype=float)
Expand Down Expand Up @@ -74,11 +74,11 @@ def get_raster_node_coordinates(grid, grid_id):
>>> g = RasterGrid()
>>> (y, x) = get_raster_node_coordinates(g, 0)
>>> y
array([[ 2., 2., 2.],
[ 3., 3., 3.]])
array([[2., 2., 2.],
[3., 3., 3.]])
>>> x
array([[ 1., 3., 5.],
[ 1., 3., 5.]])
array([[1., 3., 5.],
[1., 3., 5.]])
"""
(shape, spacing, origin) = (
grid.get_grid_shape(grid_id),
Expand Down Expand Up @@ -115,11 +115,11 @@ def get_rectilinear_node_coordinates(grid, grid_id):
>>> g = RectilinearGrid()
>>> (y, x) = get_rectilinear_node_coordinates(g, 0)
>>> y
array([[ 2., 2., 2.],
[ 7., 7., 7.]])
array([[2., 2., 2.],
[7., 7., 7.]])
>>> x
array([[ 0., 3., 4.],
[ 0., 3., 4.]])
array([[0., 3., 4.],
[0., 3., 4.]])
"""
coordinate_vectors = []
for coordinate_name in ["z", "y", "x"]:
Expand Down Expand Up @@ -160,11 +160,11 @@ def get_structured_node_coordinates(grid, grid_id):
>>> g = StructuredGrid()
>>> (y, x) = get_structured_node_coordinates(g, 0)
>>> y
array([[ 2., 2., 2.],
[ 7., 7., 7.]])
array([[2., 2., 2.],
[7., 7., 7.]])
>>> x
array([[ 0., 3., 4.],
[ 0., 3., 4.]])
array([[0., 3., 4.],
[0., 3., 4.]])
"""
node_coordinates = []
for coordinate_name in ["z", "y", "x"]:
Expand Down Expand Up @@ -246,11 +246,11 @@ class GridMixIn:
>>> c.get_grid_type(0)
'RASTER'
>>> c.get_x(0)
array([[ 0., 1., 2.],
[ 0., 1., 2.]])
array([[0., 1., 2.],
[0., 1., 2.]])
>>> c.get_y(0)
array([[ 0., 0., 0.],
[ 2., 2., 2.]])
array([[0., 0., 0.],
[2., 2., 2.]])
"""

def __init__(self):
Expand Down
1 change: 1 addition & 0 deletions pymt/events/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
hello!
hello from finalize
"""

from configparser import ConfigParser
from io import StringIO

Expand Down
1 change: 1 addition & 0 deletions pymt/events/port.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Wrap a port as a :class:`Timeline` event.
"""

import os
import sys

Expand Down
2 changes: 1 addition & 1 deletion pymt/framework/bmi_bridge.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Bridge between BMI and a PyMT component."""

import ctypes
import json
import os
Expand Down Expand Up @@ -91,7 +92,6 @@ def __str__(self):


class _BmiCapV1:

"""Add methods for backward compatibility."""

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions pymt/framework/services.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Access to framework services.
"""

import warnings

_COMPONENT_CLASSES = {}
Expand Down
2 changes: 1 addition & 1 deletion pymt/grids/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class RasterField(UniformRectilinear, StructuredField):
array([ 0., 10., 20., 30., 40.])
>>> g.get_field ('Point Data')
array([ 0., 1., 2., 3., 4., 5.])
array([0., 1., 2., 3., 4., 5.])
A 3D-Field,
Expand Down
4 changes: 2 additions & 2 deletions pymt/grids/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
>>> g = RectilinearMap ([0, 2], [0, 1, 2])
>>> g.get_x ()
array([ 0., 1., 2., 0., 1., 2.])
array([0., 1., 2., 0., 1., 2.])
>>> g.get_y ()
array([ 0., 0., 0., 2., 2., 2.])
array([0., 0., 0., 2., 2., 2.])
Node 1 is shared by both cell 0, and 1; node 5 only is part of cell 1.
Expand Down
14 changes: 7 additions & 7 deletions pymt/grids/meshgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@
>>> y = np.linspace(0, 1, ny)
>>> xv, yv = meshgrid(x, y)
>>> xv
array([[ 0. , 0.5, 1. ],
[ 0. , 0.5, 1. ]])
array([[0. , 0.5, 1. ],
[0. , 0.5, 1. ]])
>>> yv
array([[ 0., 0., 0.],
[ 1., 1., 1.]])
array([[0., 0., 0.],
[1., 1., 1.]])
>>> xv, yv = meshgrid(x, y, sparse=True) # make sparse output arrays
>>> xv
array([[ 0. , 0.5, 1. ]])
array([[0. , 0.5, 1. ]])
>>> yv
array([[ 0.],
[ 1.]])
array([[0.],
[1.]])
`meshgrid` is very useful to evaluate functions on a grid.
Expand Down
26 changes: 13 additions & 13 deletions pymt/grids/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
>>> g = UniformRectilinear ((2,3), (1,2), (.5, 0), indexing='ij', units=('m', 'km'))
>>> g.get_x()
array([ 0., 2., 4., 0., 2., 4.])
array([0., 2., 4., 0., 2., 4.])
>>> g.get_y()
array([ 0.5, 0.5, 0.5, 1.5, 1.5, 1.5])
array([0.5, 0.5, 0.5, 1.5, 1.5, 1.5])
>>> [g.get_x_units(), g.get_y_units()]
['km', 'm']
>>> g.get_z_units()
Expand All @@ -28,9 +28,9 @@
>>> g.get_shape()
array([2, 3])
>>> g.get_spacing()
array([ 1., 2.])
array([1., 2.])
>>> g.get_origin()
array([ 0.5, 0. ])
array([0.5, 0. ])
>>> g.get_offset()
array([4, 8])
>>> g.get_connectivity()
Expand All @@ -42,15 +42,15 @@
>>> g = UniformRectilinearPoints ((2,3), (1,2), (.5, 0), indexing='ij', set_connectivity=True)
>>> g.get_x()
array([ 0., 2., 4., 0., 2., 4.])
array([0., 2., 4., 0., 2., 4.])
>>> g.get_y()
array([ 0.5, 0.5, 0.5, 1.5, 1.5, 1.5])
array([0.5, 0.5, 0.5, 1.5, 1.5, 1.5])
>>> g.get_shape()
array([2, 3])
>>> g.get_spacing()
array([ 1., 2.])
array([1., 2.])
>>> g.get_origin()
array([ 0.5, 0. ])
array([0.5, 0. ])
>>> g.get_point_count()
6
Expand All @@ -72,17 +72,17 @@
>>> g = UniformRectilinearPoints ((5, ), (1., ), (.5,), indexing='ij', set_connectivity=True)
>>> g.get_x()
array([ 0.5, 1.5, 2.5, 3.5, 4.5])
array([0.5, 1.5, 2.5, 3.5, 4.5])
**3D-grid of cells**
>>> g = UniformRectilinear ((4, 3, 2), (1, 2, 3), (-1, 0, 1), indexing='ij')
>>> g.get_x()
array([ 1., 4., 1., 4., 1., 4., 1., 4., 1., 4., 1., 4., 1.,
4., 1., 4., 1., 4., 1., 4., 1., 4., 1., 4.])
array([1., 4., 1., 4., 1., 4., 1., 4., 1., 4., 1., 4., 1., 4., 1., 4., 1.,
4., 1., 4., 1., 4., 1., 4.])
>>> g.get_y()
array([ 0., 0., 2., 2., 4., 4., 0., 0., 2., 2., 4., 4., 0.,
0., 2., 2., 4., 4., 0., 0., 2., 2., 4., 4.])
array([0., 0., 2., 2., 4., 4., 0., 0., 2., 2., 4., 4., 0., 0., 2., 2., 4.,
4., 0., 0., 2., 2., 4., 4.])
>>> g.get_z()
array([-1., -1., -1., -1., -1., -1., 0., 0., 0., 0., 0., 0., 1.,
1., 1., 1., 1., 1., 2., 2., 2., 2., 2., 2.])
Expand Down
34 changes: 17 additions & 17 deletions pymt/grids/rectilinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
>>> g.get_cell_count()
6
>>> g.get_x()
array([ 1., 2., 4., 8., 1., 2., 4., 8., 1., 2., 4., 8.])
array([1., 2., 4., 8., 1., 2., 4., 8., 1., 2., 4., 8.])
>>> g.get_y()
array([ 1., 1., 1., 1., 2., 2., 2., 2., 3., 3., 3., 3.])
array([1., 1., 1., 1., 2., 2., 2., 2., 3., 3., 3., 3.])
>>> g.get_shape()
array([3, 4])
Create a grid of length 2 in the i direction, and 3 in the j direction.
>>> g = Rectilinear([1., 2., 4., 8.], [1., 2., 3.], indexing='ij')
>>> g.get_x()
array([ 1., 2., 3., 1., 2., 3., 1., 2., 3., 1., 2., 3.])
array([1., 2., 3., 1., 2., 3., 1., 2., 3., 1., 2., 3.])
>>> g.get_y()
array([ 1., 1., 1., 2., 2., 2., 4., 4., 4., 8., 8., 8.])
array([1., 1., 1., 2., 2., 2., 4., 4., 4., 8., 8., 8.])
>>> g.get_shape()
array([4, 3])
Expand All @@ -38,9 +38,9 @@
>>> g = RectilinearPoints ([1., 2., 4., 8.], [1., 2., 3.], indexing='ij', set_connectivity=True)
>>> g.get_x()
array([ 1., 2., 3., 1., 2., 3., 1., 2., 3., 1., 2., 3.])
array([1., 2., 3., 1., 2., 3., 1., 2., 3., 1., 2., 3.])
>>> g.get_y()
array([ 1., 1., 1., 2., 2., 2., 4., 4., 4., 8., 8., 8.])
array([1., 1., 1., 2., 2., 2., 4., 4., 4., 8., 8., 8.])
>>> g.get_shape ()
array([4, 3])
>>> g.get_point_count()
Expand All @@ -63,7 +63,7 @@
>>> g = Rectilinear([1,3,4,5,6], set_connectivity=True)
>>> g.get_x()
array([ 1., 3., 4., 5., 6.])
array([1., 3., 4., 5., 6.])
>>> g.get_point_count()
5
>>> g.get_cell_count()
Expand All @@ -78,26 +78,26 @@
>>> g = Rectilinear ([0, 1], [2, 3], set_connectivity=True, indexing='ij')
>>> g.get_x()
array([ 2., 3., 2., 3.])
array([2., 3., 2., 3.])
>>> g.get_y()
array([ 0., 0., 1., 1.])
array([0., 0., 1., 1.])
>>> g = Rectilinear ([0, 1], [2, 3], [4, 5], set_connectivity=True, indexing='ij')
>>> g.get_x()
array([ 4., 5., 4., 5., 4., 5., 4., 5.])
array([4., 5., 4., 5., 4., 5., 4., 5.])
>>> g.get_y()
array([ 2., 2., 3., 3., 2., 2., 3., 3.])
array([2., 2., 3., 3., 2., 2., 3., 3.])
>>> g.get_z()
array([ 0., 0., 0., 0., 1., 1., 1., 1.])
array([0., 0., 0., 0., 1., 1., 1., 1.])
>>> g.get_point_count()
8
>>> g.get_cell_count()
1
>>> g = Rectilinear([0, 1, 2, 3], [4, 5, 6], [7, 8], set_connectivity=True, indexing='ij')
>>> g.get_x()
array([ 7., 8., 7., 8., 7., 8., 7., 8., 7., 8., 7., 8., 7.,
8., 7., 8., 7., 8., 7., 8., 7., 8., 7., 8.])
array([7., 8., 7., 8., 7., 8., 7., 8., 7., 8., 7., 8., 7., 8., 7., 8., 7.,
8., 7., 8., 7., 8., 7., 8.])
>>> g.get_shape()
array([4, 3, 2])
>>> x = g.get_x()
Expand Down Expand Up @@ -153,7 +153,7 @@ def get_x_coordinates(self):
>>> g = Rectilinear([0, 1], [2, 3], [4, 5], set_connectivity=True, indexing='ij')
>>> g.get_x_coordinates()
array([ 4., 5.])
array([4., 5.])
"""
return self._x_coordinates

Expand All @@ -164,7 +164,7 @@ def get_y_coordinates(self):
>>> g = Rectilinear([0, 1], [2, 3], [4, 5], set_connectivity=True, indexing='ij')
>>> g.get_y_coordinates()
array([ 2., 3.])
array([2., 3.])
"""
return self._y_coordinates

Expand All @@ -175,7 +175,7 @@ def get_z_coordinates(self):
>>> g = Rectilinear([0, 1], [2, 3], [4, 5], set_connectivity=True, indexing='ij')
>>> g.get_z_coordinates()
array([ 0., 1.])
array([0., 1.])
"""
return self._z_coordinates

Expand Down
Loading

0 comments on commit da1f83d

Please sign in to comment.