Beispiel #1
0
 def __init__(self, paths):
     self.paths = paths
     self.table = {initial_time(p): p for p in paths}
     self.initial_times = np.array([initial_time(p) for p in paths],
                                   dtype='datetime64[s]')
     with netCDF4.Dataset(self.paths[0]) as dataset:
         if "pressure" in dataset.variables:
             self.pressures = dataset.variables["pressure"][:]
         else:
             self.pressures = None
         self.pressure_variables = self.load_heights(dataset)
Beispiel #2
0
 def __init__(self, paths):
     self.paths = paths
     self.table = defaultdict(list)
     for path in paths:
         time = initial_time(path)
         if time is None:
             try:
                 with netCDF4.Dataset(path) as dataset:
                     var = dataset.variables["forecast_reference_time"]
                     time = netCDF4.num2date(var[:], units=var.units)
             except KeyError:
                 continue
         self.table[self.key(time)].append(path)