pyGDP = pyGDP.pyGDPwebProcessing() shapefiles = pyGDP.getShapefiles() print('Available shapefiles: ') for shapefile in shapefiles: print(shapefile) # Grab the file and get its attributes: shapefile = 'sample:CSC_Boundaries' attributes = pyGDP.getAttributes(shapefile) for attr in attributes: print(attr) # Grab the values from 'area_name' and 'sample:CSC_Boundaries' usr_attribute = 'area_name' values = pyGDP.getValues(shapefile, usr_attribute) for v in values: print(v) usr_value = 'Southwest' dataSetURI = 'dods://cida.usgs.gov/thredds/dodsC/gmo/GMO_w_meta.ncml' dataTypes = pyGDP.getDataType(dataSetURI) for d in dataTypes: print(d) dataType = 'Prcp' # Get available time range on the dataset timeRange = pyGDP.getTimeRange(dataSetURI, dataType) for t in timeRange: print(t)
shapefiles = pyGDP.getShapefiles() print 'Available shapefiles: ' for shapefile in shapefiles: print shapefile print # Grab the file and get its attributes: shapefile = 'sample:CONUS_States' attributes = pyGDP.getAttributes(shapefile) for attr in attributes: print attr print # Grab the values from 'OBJECTID' and 'upload:OKCNTYD' usr_attribute = 'STATE' values = pyGDP.getValues(shapefile, usr_attribute) for v in values: print v print # our shapefile = 'upload:OKCNTYD', usr_attribute = 'OBJECTID', and usr_value = 13 # We get the dataset URI that we are interested in dataSetURIs = pyGDP.getDataSetURI() for d in dataSetURIs: print d # Set our datasetURI dataSetURI = 'dods://igsarm-cida-thredds1.er.usgs.gov:8080/thredds/dodsC/gmo/GMO_w_meta.ncml' # Get the available data types associated with the dataset dataType = 'Prcp' # Get available time range on the dataset
pyGDP = pyGDP.pyGDPwebProcessing() shapefile = 'upload:Final_Compiled_LOCA_Points_of_interest_buffer200' attributes = pyGDP.getAttributes(shapefile) for attr in attributes: print attr polyAttribute = 'Name' values = pyGDP.getValues(shapefile, polyAttribute) for v in values: print v polyValue = 'BD_Mtn' dataSetURI = 'http://cida.usgs.gov/thredds/dodsC/loca_historical' datatypes = pyGDP.getDataType(dataSetURI) outputpath_earlys=list() DataTypes_list = ['pr_ACCESS1-0','pr_CanESM2', 'pr_CCSM4', 'pr_CESM1-BGC', 'pr_CMCC-CMS',\ 'pr_CNRM-CM5', 'pr_GFDL-CM3', 'pr_HadGEM2-CC', \ 'pr_HadGEM2-ES', 'pr_MIROC-ESM-CHEM', 'pr_MIROC-ESM', \ 'pr_CSIRO-Mk3-6-0', 'pr_GFDL-ESM2M']
QA = False #if true, reset locations for services to QA servers filePath = '/Volumes/projects/WiLMA/LTER_donuts/' if QA: print 'using QA servers and services' pyGDP.WFS_URL = 'http://cida-wiwsc-gdp2qa.er.usgs.gov:8082/geoserver/wfs' pyGDP.upload_URL = 'http://cida-wiwsc-gdp2qa.er.usgs.gov:8082/geoserver' pyGDP.WPS_Service = 'http://cida.usgs.gov/qa/climate/gdp/utility/WebProcessingService' pyGDP.WPS_URL = 'http://cida.usgs.gov/qa/climate/gdp/process/WebProcessingService' # initialize pyGDP object pyGDP = pyGDP.pyGDPwebProcessing() for filename in os.listdir(filePath): try: shpfile = pyGDP.uploadShapeFile(filePath+filename), print 'successfully uploaded %r' % (shpfile) # get attributes att = pyGDP.getAttributes('%s' % (shpfile)) val = pyGDP.getValues('%s' % (shpfile),att[1]) for v in val: print '%s has attribute %s and value %s' % (shpfile,att[1],v) except Exception, msg: shpfile = filename[0:len(filename)-4] print '%s %s' % (shpfile,msg)