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, dataset=None, spatial_extent=None, date_range=None, start_time=None, end_time=None, version=None, files=None, ): warnings.filterwarnings("always") warnings.warn( "Please note: as of 2020-05-05, a major reorganization of the core icepyx.icesat2data 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)
def test_lowercase_dataset(): lcds = "atl03" obs = is2ref._validate_dataset(lcds) expected = "ATL03" assert obs == expected
def test_bad_dataset(): wrngds = "atl-6" ermsg = "Please enter a valid dataset" with pytest.raises(AssertionError, match=ermsg): is2ref._validate_dataset(wrngds)
def test_num_dataset(): dsnum = 6 ermsg = "Please enter a dataset string" with pytest.raises(TypeError, match=ermsg): is2ref._validate_dataset(dsnum)
def test_lowercase_dataset(): lcds = 'atl03' obs = is2ref._validate_dataset(lcds) expected = 'ATL03' assert obs == expected
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)