Esempio n. 1
0
def usage():
    sys.stderr.write("""
Usage: acis_data.py basin elem [syear] [eyear] [inact] [years]

 basin:\tbasin(s) (HUC8, required)
 elem:\telement code (required, see below)
 syear:\tStart year (default 1950)
 eyear:\tEnd year (default %s)
 inact:\tInclude inactive sites (default false)
 years:\tOnly include sites with this many years of data (default 30)

Inactive sites are considered to be sites that have not had any data for n
years, where n is the same as the years argument.

Available elem codes:
""" % curyear)

    for elem in sorted(ELEMENT_BY_NAME.keys()):
        sys.stderr.write(" %s:\t%s\n" % (elem, ELEMENT_BY_NAME[elem]['desc']))
    exit()
Esempio n. 2
0
def usage():
    sys.stderr.write("""
Usage: acis_data.py basin elem [syear] [eyear] [inact] [years]

 basin:\tbasin(s) (HUC8, required)
 elem:\telement code (required, see below)
 syear:\tStart year (default 1950)
 eyear:\tEnd year (default %s)
 inact:\tInclude inactive sites (default false)
 years:\tOnly include sites with this many years of data (default 30)

Inactive sites are considered to be sites that have not had any data for n
years, where n is the same as the years argument.

Available elem codes:
""" % curyear)

    for elem in sorted(ELEMENT_BY_NAME.keys()):
        sys.stderr.write(" %s:\t%s\n" % (elem, ELEMENT_BY_NAME[elem]['desc']))
    exit()
Esempio n. 3
0
#!/Users/noellepatterson/apps/Ecogeo-code/my-virtualenv/bin/python3
from __future__ import print_function
import sys
from datetime import date
from climata.acis import StationMetaIO
from climata.acis.constants import (ELEMENT_BY_NAME, ELEMENT_BY_ID,
                                    ALL_META_FIELDS)

elems = ELEMENT_BY_NAME.copy()

# Eloement 7 (pan evap) does not have a name, copy from ID listing
elems['7'] = ELEMENT_BY_ID['7']


def load_sites(*basin_ids):
    """
    Load metadata for all sites in given basin codes.
    """

    # Resolve basin ids to HUC8s if needed
    basins = []
    for basin in basin_ids:
        if basin.isdigit() and len(basin) == 8:
            basins.append(basin)
        else:
            from climata.huc8 import get_huc8
            basins.extend(get_huc8(basin))

    # Load sites with data since 1900
    sites = StationMetaIO(
        basin=basins,
Esempio n. 4
0
#!/usr/bin/env python
from __future__ import print_function
import sys
from datetime import date
from climata.acis import StationMetaIO
from climata.acis.constants import (
    ELEMENT_BY_NAME, ELEMENT_BY_ID, ALL_META_FIELDS
)

elems = ELEMENT_BY_NAME.copy()

# Eloement 7 (pan evap) does not have a name, copy from ID listing
elems['7'] = ELEMENT_BY_ID['7']


def load_sites(*basin_ids):
    """
    Load metadata for all sites in given basin codes.
    """

    # Resolve basin ids to HUC8s if needed
    basins = []
    for basin in basin_ids:
        if basin.isdigit() and len(basin) == 8:
            basins.append(basin)
        else:
            from climata.huc8 import get_huc8
            basins.extend(get_huc8(basin))

    # Load sites with data since 1900
    sites = StationMetaIO(