How to use the ulmo.usgs.nwis function in ulmo

To help you get started, we’ve selected a few ulmo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github erdc / quest / quest_provider_plugins / usgs_nwis.py View on Github external
parameter = p.parameter
        start = p.start
        end = p.end
        period = p.period

        if dataset is None:
            dataset = 'station-' + catalog_id

        if start and end:
            period = None

        pmap = self.parameter_map(invert=True)
        parameter_code, statistic_code = (pmap[parameter].split(':') + [None])[:2]

        data = nwis.get_site_data(catalog_id,
                                  parameter_code=parameter_code,
                                  statistic_code=statistic_code,
                                  start=start, end=end, period=period,
                                  service=self.service_name)

        # dict contains only one key since only one parameter/statistic was
        # downloaded, this would need to be changed if multiple
        # parameter/stat were downloaded together
        if not data:
            raise ValueError('No Data Available')

        data = list(data.values())[0]

        # convert to dataframe and cleanup bad data
        df = pd.DataFrame(data['values'])
        if df.empty: