|
1 | 1 | import collections |
2 | 2 | import hashlib |
3 | 3 | import logging |
4 | | -import os |
5 | 4 | from functools import wraps |
6 | 5 | from textwrap import dedent |
7 | 6 |
|
8 | 7 | import netCDF4 as nc4 |
9 | 8 | import numpy as np |
10 | 9 |
|
11 | 10 | from gridded import VALID_LOCATIONS |
12 | | -from gridded.depth import Depth, DepthBase |
| 11 | +from gridded.depth import Depth |
13 | 12 | from gridded.grids import Grid, Grid_R, Grid_S, Grid_U |
14 | 13 | from gridded.time import Time |
15 | 14 | from gridded.utilities import ( |
16 | | - _align_results_to_spatial_data, |
17 | 15 | _reorganize_spatial_data, |
18 | 16 | asarraylike, |
19 | 17 | get_dataset, |
20 | 18 | parse_filename_dataset_args, |
21 | | - search_dataset_for_variables_by_varname, |
22 | 19 | ) |
23 | 20 |
|
24 | 21 | log = logging.getLogger(__name__) |
@@ -392,14 +389,13 @@ def data(self, d): |
392 | 389 | if self.time is not None and len(d) != len(self.time): |
393 | 390 | raise ValueError("Data/time interval mismatch") |
394 | 391 | ## fixme: we should check Depth, too. |
395 | | - # if self.grid is not None and self.grid.infer_location(d) is None: |
396 | | - # raise ValueError("Data/grid shape mismatch. Data shape is {0}, Grid shape is {1}".format(d.shape, self.grid.node_lon.shape)) |
397 | 392 | if self.grid is not None: # if there is not a grid, we can't check this |
398 | 393 | if self.location is None: # not set, let's try to figure it out |
399 | 394 | self.location = self.grid.infer_location(d) |
400 | 395 | if self.location is None: |
401 | 396 | raise ValueError( |
402 | | - f"Data/grid shape mismatch: Data shape is {d.shape}, Grid shape is {self.grid.node_lon.shape}" |
| 397 | + f"Data/grid shape mismatch: Data shape is {d.shape}, " |
| 398 | + f"Grid shape is {self.grid.node_lon.shape}" |
403 | 399 | ) |
404 | 400 | self._data = d |
405 | 401 |
|
@@ -655,7 +651,6 @@ def _xy_interp(self, points, time, extrapolate, slices=(), **kwargs): |
655 | 651 | :type slices: tuple of integers or slice objects |
656 | 652 | """ |
657 | 653 | _hash = kwargs["_hash"] if "_hash" in kwargs else None |
658 | | - units = kwargs["units"] if "units" in kwargs else None |
659 | 654 |
|
660 | 655 | value = self.grid.interpolate_var_to_points( |
661 | 656 | points[:, 0:2], |
@@ -1342,8 +1337,8 @@ def _mod(n): |
1342 | 1337 | if _mod("grid"): |
1343 | 1338 | gt = kws.get("grid_topology", None) |
1344 | 1339 | kws["grid"] = Grid.from_netCDF(kws["filename"], dataset=dg, grid_topology=gt) |
1345 | | - if kws.get("varnames", None) is None: |
1346 | | - varnames = cls._gen_varnames(kws["data_file"], dataset=ds) |
| 1340 | + # if kws.get("varnames", None) is None: |
| 1341 | + # varnames = cls._gen_varnames(kws["data_file"], dataset=ds) |
1347 | 1342 | # if _mod('time'): |
1348 | 1343 | # time = Time.from_netCDF(filename=kws['data_file'], |
1349 | 1344 | # dataset=ds, |
|
0 commit comments