@@ -64,9 +64,9 @@ def __init__(
6464 if not lat .dtype == np .float32 :
6565 lat = lat .astype (np .float32 )
6666 if not time .dtype == np .float64 :
67- assert isinstance (
68- time [ 0 ], ( np . integer , np . floating , float , int )
69- ), "Time vector must be an array of int or floats"
67+ assert isinstance (time [ 0 ], ( np . integer , np . floating , float , int )), (
68+ "Time vector must be an array of int or floats"
69+ )
7070 time = time .astype (np .float64 )
7171
7272 self ._lon = lon
@@ -627,22 +627,22 @@ def __init__(
627627 self ._z4d = 1 if len (self .depth .shape ) == 4 else 0
628628 if self ._z4d :
629629 # self.depth.shape[0] is 0 for S grids loaded from netcdf file
630- assert (
631- self . tdim == self . depth . shape [ 0 ] or self . depth . shape [ 0 ] == 0
632- ), "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
633- assert (
634- self . xdim == self . depth . shape [ - 1 ] or self . depth . shape [ - 1 ] == 0
635- ), "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
636- assert (
637- self . ydim == self . depth . shape [ - 2 ] or self . depth . shape [ - 2 ] == 0
638- ), "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
630+ assert self . tdim == self . depth . shape [ 0 ] or self . depth . shape [ 0 ] == 0 , (
631+ "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
632+ )
633+ assert self . xdim == self . depth . shape [ - 1 ] or self . depth . shape [ - 1 ] == 0 , (
634+ "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
635+ )
636+ assert self . ydim == self . depth . shape [ - 2 ] or self . depth . shape [ - 2 ] == 0 , (
637+ "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
638+ )
639639 else :
640- assert (
641- self . xdim == self . depth . shape [ - 1 ]
642- ), "depth dimension has the wrong format. It should be [zdim, ydim, xdim]"
643- assert (
644- self . ydim == self . depth . shape [ - 2 ]
645- ), "depth dimension has the wrong format. It should be [zdim, ydim, xdim]"
640+ assert self . xdim == self . depth . shape [ - 1 ], (
641+ "depth dimension has the wrong format. It should be [zdim, ydim, xdim]"
642+ )
643+ assert self . ydim == self . depth . shape [ - 2 ], (
644+ "depth dimension has the wrong format. It should be [zdim, ydim, xdim]"
645+ )
646646 if not self .depth .dtype == np .float32 :
647647 self ._depth = self .depth .astype (np .float32 )
648648 if self ._lat_flipped :
@@ -799,22 +799,22 @@ def __init__(
799799 self ._z4d = 1 if len (self .depth .shape ) == 4 else 0
800800 if self ._z4d :
801801 # self.depth.shape[0] is 0 for S grids loaded from netcdf file
802- assert (
803- self . tdim == self . depth . shape [ 0 ] or self . depth . shape [ 0 ] == 0
804- ), "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
805- assert (
806- self . xdim == self . depth . shape [ - 1 ] or self . depth . shape [ - 1 ] == 0
807- ), "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
808- assert (
809- self . ydim == self . depth . shape [ - 2 ] or self . depth . shape [ - 2 ] == 0
810- ), "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
802+ assert self . tdim == self . depth . shape [ 0 ] or self . depth . shape [ 0 ] == 0 , (
803+ "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
804+ )
805+ assert self . xdim == self . depth . shape [ - 1 ] or self . depth . shape [ - 1 ] == 0 , (
806+ "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
807+ )
808+ assert self . ydim == self . depth . shape [ - 2 ] or self . depth . shape [ - 2 ] == 0 , (
809+ "depth dimension has the wrong format. It should be [tdim, zdim, ydim, xdim]"
810+ )
811811 else :
812- assert (
813- self . xdim == self . depth . shape [ - 1 ]
814- ), "depth dimension has the wrong format. It should be [zdim, ydim, xdim]"
815- assert (
816- self . ydim == self . depth . shape [ - 2 ]
817- ), "depth dimension has the wrong format. It should be [zdim, ydim, xdim]"
812+ assert self . xdim == self . depth . shape [ - 1 ], (
813+ "depth dimension has the wrong format. It should be [zdim, ydim, xdim]"
814+ )
815+ assert self . ydim == self . depth . shape [ - 2 ], (
816+ "depth dimension has the wrong format. It should be [zdim, ydim, xdim]"
817+ )
818818 if not self .depth .dtype == np .float32 :
819819 self ._depth = self .depth .astype (np .float32 )
820820
0 commit comments