def _getTimePositions(self): timepositions = [] if not hasattr(self, "descCov"): self.descCov = self._service.getDescribeCoverage(self.id) gridelem = self.descCov.find( nsWCS2("CoverageDescription/") + "{http://www.opengis.net/gml/3.2}domainSet/" + "{http://www.opengis.net/gml/3.3/rgrid}ReferenceableGridByVectors" # noqa ) if gridelem is not None: # irregular time axis cooeficients = [] grid_axes = gridelem.findall( "{http://www.opengis.net/gml/3.3/rgrid}generalGridAxis") for elem in grid_axes: if elem.find( "{http://www.opengis.net/gml/3.3/rgrid}GeneralGridAxis/{http://www.opengis.net/gml/3.3/rgrid}gridAxesSpanned" # noqa ).text in ["ansi", "unix"]: cooeficients = elem.find( "{http://www.opengis.net/gml/3.3/rgrid}GeneralGridAxis/{http://www.opengis.net/gml/3.3/rgrid}coefficients" # noqa ).text.split(" ") for x in cooeficients: x = x.replace('"', "") t_date = datetime_from_iso(x) timepositions.append(t_date) else: # regular time if len(self.grid.origin) > 2: t_grid = self.grid t_date = t_grid.origin[2] start_pos = parser.parse(t_date, fuzzy=True) step = float(t_grid.offsetvectors[2][2]) start_pos = start_pos + timedelta(days=(step / 2)) no_steps = int(t_grid.highlimits[2]) for x in range(no_steps): t_pos = start_pos + timedelta(days=(step * x)) # t_date = datetime_from_ansi(t_pos) # t_date = t_pos.isoformat() timepositions.append(t_pos) else: # no time axis timepositions = None return timepositions
def _getTimePositions(self): timepositions=[] if not hasattr(self, 'descCov'): self.descCov=self._service.getDescribeCoverage(self.id) gridelem= self.descCov.find(nsWCS2('CoverageDescription/')+'{http://www.opengis.net/gml/3.2}domainSet/'+'{http://www.opengis.net/gml/3.3/rgrid}ReferenceableGridByVectors') if gridelem is not None: # irregular time axis cooeficients = [] grid_axes = gridelem.findall('{http://www.opengis.net/gml/3.3/rgrid}generalGridAxis') for elem in grid_axes: if elem.find('{http://www.opengis.net/gml/3.3/rgrid}GeneralGridAxis/{http://www.opengis.net/gml/3.3/rgrid}gridAxesSpanned').text in ["ansi", "unix"]: cooeficients = elem.find('{http://www.opengis.net/gml/3.3/rgrid}GeneralGridAxis/{http://www.opengis.net/gml/3.3/rgrid}coefficients').text.split(' ') for x in cooeficients: x = x.replace('"', '') t_date = datetime_from_iso(x) timepositions.append(t_date) else: # regular time if(len(self.grid.origin)>2): t_grid = self.grid t_date = t_grid.origin[2] start_pos = parser.parse(t_date, fuzzy=True) step = float(t_grid.offsetvectors[2][2]) start_pos = start_pos + timedelta(days=(step/2)) no_steps = int(t_grid.highlimits[2]) for x in range(no_steps): t_pos = start_pos + timedelta(days=(step * x)) #t_date = datetime_from_ansi(t_pos) #t_date = t_pos.isoformat() timepositions.append(t_pos) else: # no time axis timepositions = None return timepositions