def __init__( self, dataset=None, spatial_extent=None, date_range=None, start_time=None, end_time=None, version=None, cycles=None, tracks=None, files=None, ): # warnings.filterwarnings("always") # warnings.warn("Please note: as of 2020-05-05, a major reorganization of the core icepyx.query code may result in errors produced by now depricated functions. Please see our documentation pages or example notebooks for updates.") if ( (dataset is None or spatial_extent is None) and (date_range is None or cycles is None or tracks is None) and files is None ): raise ValueError( "Please provide the required inputs. Use help([function]) to view the function's documentation" ) if files is not None: self._source = "files" # self.file_vars = Variables(self._source) else: self._source = "order" # self.order_vars = Variables(self._source) # self.variables = Variables(self._source) self._dset = is2ref._validate_dataset(dataset) self.extent_type, self._spat_extent, self._geom_filepath = val.spatial( spatial_extent ) if date_range: self._start, self._end = val.temporal(date_range, start_time, end_time) self._version = val.dset_version(self.latest_version(), version) # build list of available CMR parameters if reducing by cycle or RGT # or a list of explicitly named files (full or partial names) # DevGoal: add file name search to optional queries if cycles or tracks: # get lists of available ICESat-2 cycles and tracks self._cycles = val.cycles(cycles) self._tracks = val.tracks(tracks) # create list of CMR parameters for granule name self._readable_granule_name = apifmt._fmt_readable_granules( self._dset, cycles=self.cycles, tracks=self.tracks )
def __init__( self, product=None, spatial_extent=None, date_range=None, start_time=None, end_time=None, version=None, cycles=None, tracks=None, files=None, # NOTE: if you end up implemeting this feature here, use a better variable name than "files" ): # warnings.filterwarnings("always") # warnings.warn("Please note: as of 2020-05-05, a major reorganization of the core icepyx.query code may result in errors produced by now depricated functions. Please see our documentation pages or example notebooks for updates.") # Check necessary combination of input has been specified if ( (product is None or spatial_extent is None) or ( (date_range is None and cycles is None and tracks is None) and int(product[-2:]) <= 13 ) and files is None ): raise ValueError( "Please provide the required inputs. Use help([function]) to view the function's documentation" ) if files is not None: self._source = "files" # self.file_vars = Variables(self._source) else: self._source = "order" # self.order_vars = Variables(self._source) # self.variables = Variables(self._source) self._prod = is2ref._validate_product(product) super().__init__(spatial_extent, date_range, start_time, end_time) self._version = val.prod_version(self.latest_version(), version) # build list of available CMR parameters if reducing by cycle or RGT # or a list of explicitly named files (full or partial names) # DevGoal: add file name search to optional queries if cycles or tracks: # get lists of available ICESat-2 cycles and tracks self._cycles = val.cycles(cycles) self._tracks = val.tracks(tracks) # create list of CMR parameters for granule name self._readable_granule_name = apifmt._fmt_readable_granules( self._prod, cycles=self.cycles, tracks=self.tracks )
def test_cycles_negative(): ermsg = "Cycle number must be positive" with pytest.raises(AssertionError, match=ermsg): val.cycles(-1)
def test_cycles(): obs = val.cycles([1, 2, 3, 4]) exp = ['01', '02', '03', '04'] assert obs == exp
def test_cycles(): obs = val.cycles([1, 2, 3, 4]) exp = ["01", "02", "03", "04"] assert obs == exp
def __init__( self, dataset=None, spatial_extent=None, date_range=None, start_time=None, end_time=None, version=None, cycles=None, tracks=None, orbit_number=None, files=None, ): # warnings.filterwarnings("always") # warnings.warn("Please note: as of 2020-05-05, a major reorganization of the core icepyx.query code may result in errors produced by now depricated functions. Please see our documentation pages or example notebooks for updates.") if (dataset is None or spatial_extent is None or date_range is None) and files is None: raise ValueError( "Please provide the required inputs. Use help([function]) to view the function's documentation" ) if files is not None: self._source = "files" # self.file_vars = Variables(self._source) else: self._source = "order" # self.order_vars = Variables(self._source) # self.variables = Variables(self._source) self._dset = is2ref._validate_dataset(dataset) self.extent_type, self._spat_extent, self._geom_filepath = val.spatial( spatial_extent) self._start, self._end = val.temporal(date_range, start_time, end_time) self._version = val.dset_version(self.latest_version(), version) # list of CMR orbit number parameters self._orbit_number = [] # get list of available ICESat-2 cycles and tracks all_cycles, all_tracks = self.avail_granules(ids=False, cycles=True, tracks=True) self._cycles = val.cycles(all_cycles, cycles) self._tracks = val.tracks(all_tracks, tracks) # build list of available CMR orbit number if reducing by cycle or RGT if cycles or tracks: # for each available cycle of interest for c in self.cycles: # for each available track of interest for t in self.tracks: self._orbit_number.append( int(t) + (int(c) - 1) * 1387 + 201) # update the CMR parameters for orbit_number self.CMRparams['orbit_number'] = self.orbit_number # update required parameters (number of pages) self._reqparams.build_params() # update the list of available granules self.granules.get_avail(self.CMRparams, self.reqparams)