Пример #1
0
def gran_paras(filename) -> list:
    """
    Returns a list of granule information for file name string.

    Parameters
    ----------
    filename: String
        ICESat-2 file name

    Returns
    -------
    gran_paras_list : list
        A list of parameters including RGT, cycle, and datetime of ICESat-2 data granule
    """

    trk, cycl, date_str = granules.gran_IDs(
        [{
            "producer_granule_id": filename
        }],
        ids=False,
        cycles=True,
        tracks=True,
        dates=True,
    )[:]
    gran_paras_list = [int(cycl[0]), int(trk[0]), date_str[0]]

    return gran_paras_list
Пример #2
0
    def avail_granules(self, ids=False, cycles=False, tracks=False, s3urls=False):
        """
        Obtain information about the available granules for the query
        object's parameters. By default, a complete list of available granules is
        obtained and stored in the object, but only summary information is returned.
        Lists of granule IDs, cycles and RGTs can be obtained using the boolean triggers.

        Parameters
        ----------
        ids : boolean, default False
            Indicates whether the function should return a list of granule IDs.

        cycles : boolean, default False
            Indicates whether the function should return a list of orbital cycles.

        tracks : boolean, default False
            Indicates whether the function should return a list of RGTs.

        s3urls : boolean, default False
            Indicates whether the function should return a list of potential AWS s3 urls.

        Examples
        --------
        >>> reg_a = ipx.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
        >>> reg_a.avail_granules()
        {'Number of available granules': 4,
        'Average size of granules (MB)': 53.948360681525,
        'Total size of all granules (MB)': 215.7934427261}

        >>> reg_a = ipx.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-23'])
        >>> reg_a.avail_granules(ids=True)
        [['ATL06_20190221121851_08410203_005_01.h5', 'ATL06_20190222010344_08490205_005_01.h5']]
        >>> reg_a.avail_granules(cycles=True)
        [['02', '02']]
        >>> reg_a.avail_granules(tracks=True)
        [['0841', '0849']]
        """

        #         REFACTOR: add test to make sure there's a session
        if not hasattr(self, "_granules"):
            self.granules
        try:
            self.granules.avail
        except AttributeError:
            self.granules.get_avail(self.CMRparams, self.reqparams)

        if ids or cycles or tracks or s3urls:
            # list of outputs in order of ids, cycles, tracks, s3urls
            return granules.gran_IDs(
                self.granules.avail,
                ids=ids,
                cycles=cycles,
                tracks=tracks,
                s3urls=s3urls,
            )
        else:
            return granules.info(self.granules.avail)
Пример #3
0
    def avail_granules(self, ids=False, cycles=False, tracks=False):
        """
        Obtain information about the available granules for the query
        object's parameters. By default, a complete list of available granules is
        obtained and stored in the object, but only summary information is returned.
        Lists of granule IDs, cycles and RGTs can be obtained using the boolean triggers.

        Parameters
        ----------
        ids : boolean, default False
            Indicates whether the function should return a list of granule IDs.

        cycles : boolean, default False
            Indicates whether the function should return a list of orbital cycles.

        tracks : boolean, default False
            Indicates whether the function should return a list of RGTs.

        Examples
        --------
        >>> reg_a = icepyx.query.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
        >>> reg_a.avail_granules()
        {'Number of available granules': 4,
        'Average size of granules (MB)': 48.975419759750004,
        'Total size of all granules (MB)': 195.90167903900002}

        >>> reg_a = icepyx.query.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
        >>> reg_a.avail_granules(ids=True)
        >>> reg_a.avail_granules(cycles=True)
        ['02']
        >>> reg_a.avail_granules(tracks=True)
        ['0841', '0849', '0902', '0910']
        """

        #         REFACTOR: add test to make sure there's a session
        if not hasattr(self, "_granules"):
            self.granules
        try:
            self.granules.avail
        except AttributeError:
            self.granules.get_avail(self.CMRparams, self.reqparams)

        if ids or cycles or tracks:
            # list of outputs in order of ids, cycles, tracks
            return granules.gran_IDs(self.granules.avail,
                                     ids=ids,
                                     cycles=cycles,
                                     tracks=tracks)
        else:
            return granules.info(self.granules.avail)
Пример #4
0
    def avail_granules(self, ids=False):
        """
        Obtain information about the available granules for the icesat2data 
        object's parameters. By default, a complete list of available granules is
        obtained and stored in the object, but only summary information is returned.
        A list of granule IDs can be obtained using the boolean trigger.

        Parameters
        ----------
        ids : boolean, default False
            Indicates whether the function should return summary granule information (default)
            or a list of granule IDs.

        Examples
        --------
        >>> reg_a = icepyx.icesat2data.Icesat2Data('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
        >>> reg_a.avail_granules()
        {'Number of available granules': 4,
        'Average size of granules (MB)': 48.975419759750004,
        'Total size of all granules (MB)': 195.90167903900002}

        >>> reg_a = icepyx.icesat2data.Icesat2Data('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
        >>> reg_a.avail_granules(ids=True)

        """

        #REFACTOR: add test to make sure there's a session
        if not hasattr(self, '_granules'): self.granules
        try:
            self.granules.avail
        except AttributeError:
            self.granules.get_avail(self.CMRparams, self.reqparams)

        if ids == True:
            return granules.gran_IDs(self.granules.avail)
        else:
            return granules.info(self.granules.avail)