def check_for_property(self,p):
     """
     Check that the specified dataset is available for the current URL.
     Returns boolean- false if the dataset is not found
     | set service url             | ${CSWSERVICE_URL}        |
     | ${dataset_exists}           | Check for property       | free parking             |
     | Should be True              | ${dataset_exists}        |
     """
     
     csw = CatalogueServiceWeb(self._url)
     csw.getdomain('Title', dtype='property')
     return p in csw.results.values()[0]
示例#2
0
endpoint = 'http://catalog.data.gov/csw-all'
#endpoint = 'http://data.doi.gov/csw'
csw = CatalogueServiceWeb(endpoint,timeout=60)
print csw.version


# In[3]:

csw.get_operation_by_name('GetRecords').constraints


# In[4]:

try:
    csw.get_operation_by_name('GetDomain')
    csw.getdomain('apiso:ServiceType', 'property')
    print(csw.results['values'])
except:
    print('GetDomain not supported')


# In[5]:

val = 'laterite'
filter1 = fes.PropertyIsLike(propertyname='apiso:AnyText',literal=('*%s*' % val),
                        escapeChar='\\',wildCard='*',singleChar='?')
filter_list = [ filter1 ]


# In[6]:
endpoint = 'http://geoport.whoi.edu/csw'
#endpoint = 'http://catalog.data.gov/csw-all'
#endpoint = 'http://www.ngdc.noaa.gov/geoportal/csw'
#endpoint = 'http://www.nodc.noaa.gov/geoportal/csw'
csw = CatalogueServiceWeb(endpoint, timeout=60)
print csw.version

# In[3]:

csw.get_operation_by_name('GetRecords').constraints

# In[4]:

try:
    csw.get_operation_by_name('GetDomain')
    csw.getdomain('apiso:ServiceType', 'property')
    print(csw.results['values'])
except:
    print('GetDomain not supported')

# ## Query for all COAWST datasets

# In[5]:

val = 'COAWST'
filter1 = fes.PropertyIsLike(propertyname='apiso:AnyText',
                             literal=('*%s*' % val),
                             escapeChar='\\',
                             wildCard='*',
                             singleChar='?')
filter_list = [filter1]
示例#4
0
[op.name for op in csw.operations]

# <codecell>

bbox = [-141, 42, -52, 84]
#bbox=[-71.5, 39.5, -63.0, 46]
csw.getrecords(keywords=['sea_water_temperature'], bbox=bbox, maxrecords=20)
#csw.getrecords(keywords=['sea_water_temperature'],maxrecords=20)
csw.results

# <codecell>

for rec, item in csw.records.iteritems():
    print rec
    print item.abstract

# <codecell>

a = csw.records[
    'data/oceansites/DATA/STATION-M/OS_STATION-M-1_194810_D_CTD.nc']

# <codecell>

print a.xml

# <codecell>

# get supported result types
csw.getdomain('GetRecords.resultType')
csw.results
示例#5
0
[op.name for op in csw.operations]

# <codecell>

bbox=[-141,42,-52,84]
#bbox=[-71.5, 39.5, -63.0, 46]
csw.getrecords(keywords=['sea_water_temperature'],bbox=bbox,maxrecords=20)
#csw.getrecords(keywords=['sea_water_temperature'],maxrecords=20)
csw.results

# <codecell>

for rec,item in csw.records.iteritems():
    print rec
    print item.abstract

# <codecell>

a=csw.records['data/oceansites/DATA/STATION-M/OS_STATION-M-1_194810_D_CTD.nc']

# <codecell>

print a.xml

# <codecell>

# get supported result types
csw.getdomain('GetRecords.resultType')
csw.results

endpoint = "http://catalog.data.gov/csw-all"
# endpoint = 'http://geonode.wfp.org/catalogue/csw'
csw = CatalogueServiceWeb(endpoint, timeout=60)
print csw.version


# In[3]:

csw.get_operation_by_name("GetRecords").constraints


# In[4]:

try:
    csw.get_operation_by_name("GetDomain")
    csw.getdomain("apiso:ServiceType", "property")
    print (csw.results["values"])
except:
    print ("GetDomain not supported")


# In[5]:

val = "COAWST"
# val = 'COADS'
filter1 = fes.PropertyIsLike(
    propertyname="apiso:AnyText", literal=("*%s*" % val), escapeChar="\\", wildCard="*", singleChar="?"
)
filter_list = [filter1]

示例#7
0
    sys.exit(3)

if schema == 'iso':
    outputschema = 'http://www.isotc211.org/2005/gmd'

# init
c = CatalogueServiceWeb(url, lang, version)

if request == 'GetCapabilities':
    pass
elif request == 'DescribeRecord':
    c.describerecord(typename)
elif request == 'GetRecordById':
    c.getrecordbyid([id])
elif request == 'GetDomain':
    c.getdomain(dname, dtype)
elif request == 'GetRecords':
    c.getrecords(qtype, [keyword], bbox, esn, sortby, schema)

if print_request is True:  # print the request
    print c.request

if validate is True:  # do XML validation
    print 'Validating request XML'
    if util.xmlvalid(c.request, csw.schema_location.split()[1]) is True:
        print 'request is valid XML'
    else:
        print 'request is NOT valid XML'

# print response
print c.response
# In[161]:

endpoint = 'http://www.ngdc.noaa.gov/geoportal/csw'  #  NGDC/IOOS Geoportal
csw = CatalogueServiceWeb(endpoint, timeout=60)
csw.version

# In[162]:

csw.get_operation_by_name('GetRecords').constraints

# In[163]:

try:
    csw.get_operation_by_name('GetDomain')
    csw.getdomain('apiso:ServiceType', 'property')
    print(csw.results['values'])
except:
    print('GetDomain not supported')

# In[164]:

val = 'level'
filter1 = fes.PropertyIsLike(propertyname='apiso:AnyText',
                             literal=('*%s*' % val),
                             escapeChar='\\',
                             wildCard='*',
                             singleChar='?')
filter_list = [filter1]

# In[165]:
示例#9
0
    sys.exit(3)

if schema == 'iso':
  outputschema = 'http://www.isotc211.org/2005/gmd'

# init
c = CatalogueServiceWeb(url, lang, version)

if request == 'GetCapabilities':
    pass
elif request == 'DescribeRecord':
    c.describerecord(typename)
elif request == 'GetRecordById':
    c.getrecordbyid([id])
elif request == 'GetDomain':
    c.getdomain(dname, dtype)
elif request == 'GetRecords':
    c.getrecords(qtype, [keyword], bbox, esn, sortby, schema)

if print_request is True: # print the request
    print c.request

if validate is True: # do XML validation
    print 'Validating request XML'
    if util.xmlvalid(c.request, csw.schema_location.split()[1]) is True:
        print 'request is valid XML'
    else:
        print 'request is NOT valid XML'

# print response
print c.response
endpoint = 'http://www.ngdc.noaa.gov/geoportal/csw' #  NGDC/IOOS Geoportal
csw = CatalogueServiceWeb(endpoint,timeout=60)
csw.version


# In[162]:

csw.get_operation_by_name('GetRecords').constraints


# In[163]:

try:
    csw.get_operation_by_name('GetDomain')
    csw.getdomain('apiso:ServiceType', 'property')
    print(csw.results['values'])
except:
    print('GetDomain not supported')


# In[164]:

val = 'level'
filter1 = fes.PropertyIsLike(propertyname='apiso:AnyText',literal=('*%s*' % val),
                        escapeChar='\\',wildCard='*',singleChar='?')
filter_list = [ filter1 ]


# In[165]:
示例#11
0
 def mdPropertyValues(self, cswurl, dname):
     """returns a value list for a property name"""
     csw = CatalogueServiceWeb(cswurl, skip_caps=True)
     csw.getdomain(dname, dtype='property')
     return csw.results
示例#12
0
 def mdPropertyValues(self, cswurl, dname):
     """returns a value list for a property name"""
     csw = CatalogueServiceWeb(cswurl, skip_caps=True)
     csw.getdomain(dname, dtype='property')
     return csw.results