In [83]:
a='http://geoport.whoi.edu/thredds/wms/coawst_4/use/fmrc/coawst_4_use_best.ncd?service=WMS&version=1.3.0&request=GetCapabilities'

In [84]:
# create a name for the WMS layer from the URL 
# by finding the text after the last '/' and before the '.' or the '?', which ever comes first
# also don't allow '-' in the name, as SciWMS doesn't like hyphens
nam=a.split('/')[-1].replace('-','_').replace('.','?').split('?')[0]
print nam


coawst_4_use_best

In [85]:
# SCI-WMS endpoint
b='http://geoport.whoi.edu:8899/wms/datasets/%s/?REQUEST=GetCapabilities' % nam

In [86]:
b


Out[86]:
'http://geoport.whoi.edu:8899/wms/datasets/coawst_4_use_best/?REQUEST=GetCapabilities'

In [87]:
import os
import urllib
from thredds_crawler.crawl import Crawl
from lxml import etree as et

In [88]:
import logging
import logging.handlers
logger = logging.getLogger('thredds_crawler')
fh = logging.handlers.RotatingFileHandler('/usgs/data0/iso/logs/iso_harvest.log', maxBytes=1024*1024*10, backupCount=5)
fh.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
ch.setFormatter(formatter)
logger.addHandler(fh)
logger.addHandler(ch)
logger.setLevel(logging.DEBUG)

SAVE_DIR="/usgs/data0/iso/iso_records"

namespace = {'gco': 'http://www.isotc211.org/2005/gco',
             'gmd': 'http://www.isotc211.org/2005/gmd'
             }

THREDDS_SERVERS = {
    "necofs1": "http://www.smast.umassd.edu:8080/thredds/forecasts.html",
    "coawst":   "http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html" 
}

for subfolder, thredds_url in THREDDS_SERVERS.items():
  logger.info("Crawling %s (%s)" % (subfolder, thredds_url))
  crawler = Crawl(thredds_url, debug=True)
  isos = [(d.id, s.get("url")) for d in crawler.datasets for s in d.services if s.get("service").lower() == "iso"]
  filefolder = os.path.join(SAVE_DIR, subfolder)
  if not os.path.exists(filefolder):
    os.makedirs(filefolder)
  for iso in isos:
    try:
      filename = iso[0].replace("/", "_") + ".iso.xml"
      filepath = os.path.join(filefolder, filename)
      logger.info("Downloading/Saving %s" % filepath)
      # retrieve XML from ncISO and put in file:
#      urllib.urlretrieve(iso[1], filepath)
      # retrieve XML from ncISO and put in etree
      tree = et.parse(iso[1])
      # Does metadata contain 'CMG_Portal' in a gco:CharacterString element?
      # if so, replace Thredds WMS endpoint with a SciWMS endpoint
      if tree.xpath(".//gco:CharacterString[text()='CMG_Portal']", namespaces=namespace):
        # find element with thredds WMS endpoint
        ele = tree.xpath(".//gmd:URL[contains(text(), 'thredds/wms')]", namespaces=namespace)
        url = ele[0].text
        # find the dataset name to use in the SciWMS endpoint
        name = url.split('/')[-1].replace('-','_').replace('.','?').split('?')[0]
        # replace element with new SciWMS endpoint
        new_url = 'http://geoport.whoi.edu:8899/wms/datasets/{0}/?REQUEST=GetCapabilities'.format(name)
        ele[0].text = new_url
        with open(filepath, 'w') as f:
          f.write(et.tostring(tree, pretty_print=True))
    except BaseException:
      logger.exception("Error!")


2015-02-11 16:43:33,757 - thredds_crawler - INFO - Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - [INFO] Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - [INFO] Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - thredds_crawler - INFO - Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - [INFO] Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - [INFO] Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - thredds_crawler - INFO - Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - [INFO] Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - thredds_crawler - INFO - Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - [INFO] Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - thredds_crawler - INFO - Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - [INFO] Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,757 - thredds_crawler - INFO - Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
INFO:thredds_crawler:Crawling coawst (http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html)
2015-02-11 16:43:33,765 - thredds_crawler - INFO - Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - [INFO] Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - [INFO] Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - thredds_crawler - INFO - Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - [INFO] Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - [INFO] Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - thredds_crawler - INFO - Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - [INFO] Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - thredds_crawler - INFO - Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - [INFO] Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - thredds_crawler - INFO - Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - [INFO] Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - thredds_crawler - INFO - Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,765 - [INFO] Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
INFO:thredds_crawler:Crawling: http://geoport.whoi.edu/thredds/catalog/coawst_4/use/fmrc/catalog.html
2015-02-11 16:43:33,782 - thredds_crawler - DEBUG - Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - [DEBUG] Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - [DEBUG] Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - thredds_crawler - DEBUG - Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - [DEBUG] Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - [DEBUG] Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - thredds_crawler - DEBUG - Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - [DEBUG] Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - thredds_crawler - DEBUG - Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - [DEBUG] Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - thredds_crawler - DEBUG - Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - [DEBUG] Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - thredds_crawler - DEBUG - Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,782 - [DEBUG] Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
DEBUG:thredds_crawler:Processing coawst_4/use/fmrc/coawst_4_use_best.ncd
2015-02-11 16:43:33,799 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:33,799 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
INFO:thredds_crawler:Downloading/Saving /usgs/data0/iso/iso_records/coawst/coawst_4_use_fmrc_coawst_4_use_best.ncd.iso.xml
2015-02-11 16:43:34,517 - thredds_crawler - INFO - Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - [INFO] Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - [INFO] Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - thredds_crawler - INFO - Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - [INFO] Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - [INFO] Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - thredds_crawler - INFO - Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - [INFO] Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - thredds_crawler - INFO - Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - [INFO] Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - thredds_crawler - INFO - Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - [INFO] Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - thredds_crawler - INFO - Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,517 - [INFO] Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
INFO:thredds_crawler:Crawling necofs1 (http://www.smast.umassd.edu:8080/thredds/forecasts.html)
2015-02-11 16:43:34,523 - thredds_crawler - INFO - Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - [INFO] Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - [INFO] Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - thredds_crawler - INFO - Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - [INFO] Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - [INFO] Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - thredds_crawler - INFO - Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - [INFO] Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - thredds_crawler - INFO - Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - [INFO] Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - thredds_crawler - INFO - Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - [INFO] Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - thredds_crawler - INFO - Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - [INFO] Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,523 - [INFO] Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
INFO:thredds_crawler:Crawling: http://www.smast.umassd.edu:8080/thredds/forecasts.html
2015-02-11 16:43:34,572 - thredds_crawler - DEBUG - Processing gom3_nocache
2015-02-11 16:43:34,572 - [DEBUG] Processing gom3_nocache
2015-02-11 16:43:34,572 - [DEBUG] Processing gom3_nocache
2015-02-11 16:43:34,572 - thredds_crawler - DEBUG - Processing gom3_nocache
2015-02-11 16:43:34,572 - [DEBUG] Processing gom3_nocache
2015-02-11 16:43:34,572 - [DEBUG] Processing gom3_nocache
2015-02-11 16:43:34,572 - thredds_crawler - DEBUG - Processing gom3_nocache
2015-02-11 16:43:34,572 - [DEBUG] Processing gom3_nocache
2015-02-11 16:43:34,572 - thredds_crawler - DEBUG - Processing gom3_nocache
2015-02-11 16:43:34,572 - [DEBUG] Processing gom3_nocache
2015-02-11 16:43:34,572 - thredds_crawler - DEBUG - Processing gom3_nocache
2015-02-11 16:43:34,572 - [DEBUG] Processing gom3_nocache
2015-02-11 16:43:34,572 - thredds_crawler - DEBUG - Processing gom3_nocache
2015-02-11 16:43:34,572 - [DEBUG] Processing gom3_nocache
2015-02-11 16:43:34,572 - [DEBUG] Processing gom3_nocache
DEBUG:thredds_crawler:Processing gom3_nocache
2015-02-11 16:43:34,614 - thredds_crawler - DEBUG - Processing necofs_met
2015-02-11 16:43:34,614 - [DEBUG] Processing necofs_met
2015-02-11 16:43:34,614 - [DEBUG] Processing necofs_met
2015-02-11 16:43:34,614 - thredds_crawler - DEBUG - Processing necofs_met
2015-02-11 16:43:34,614 - [DEBUG] Processing necofs_met
2015-02-11 16:43:34,614 - [DEBUG] Processing necofs_met
2015-02-11 16:43:34,614 - thredds_crawler - DEBUG - Processing necofs_met
2015-02-11 16:43:34,614 - [DEBUG] Processing necofs_met
2015-02-11 16:43:34,614 - thredds_crawler - DEBUG - Processing necofs_met
2015-02-11 16:43:34,614 - [DEBUG] Processing necofs_met
2015-02-11 16:43:34,614 - thredds_crawler - DEBUG - Processing necofs_met
2015-02-11 16:43:34,614 - [DEBUG] Processing necofs_met
2015-02-11 16:43:34,614 - thredds_crawler - DEBUG - Processing necofs_met
2015-02-11 16:43:34,614 - [DEBUG] Processing necofs_met
2015-02-11 16:43:34,614 - [DEBUG] Processing necofs_met
DEBUG:thredds_crawler:Processing necofs_met
2015-02-11 16:43:34,653 - thredds_crawler - DEBUG - Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - [DEBUG] Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - [DEBUG] Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - thredds_crawler - DEBUG - Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - [DEBUG] Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - [DEBUG] Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - thredds_crawler - DEBUG - Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - [DEBUG] Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - thredds_crawler - DEBUG - Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - [DEBUG] Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - thredds_crawler - DEBUG - Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - [DEBUG] Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - thredds_crawler - DEBUG - Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - [DEBUG] Processing necofs_gom3_wave
2015-02-11 16:43:34,653 - [DEBUG] Processing necofs_gom3_wave
DEBUG:thredds_crawler:Processing necofs_gom3_wave
2015-02-11 16:43:34,693 - thredds_crawler - DEBUG - Processing massbay_nocache
2015-02-11 16:43:34,693 - [DEBUG] Processing massbay_nocache
2015-02-11 16:43:34,693 - [DEBUG] Processing massbay_nocache
2015-02-11 16:43:34,693 - thredds_crawler - DEBUG - Processing massbay_nocache
2015-02-11 16:43:34,693 - [DEBUG] Processing massbay_nocache
2015-02-11 16:43:34,693 - [DEBUG] Processing massbay_nocache
2015-02-11 16:43:34,693 - thredds_crawler - DEBUG - Processing massbay_nocache
2015-02-11 16:43:34,693 - [DEBUG] Processing massbay_nocache
2015-02-11 16:43:34,693 - thredds_crawler - DEBUG - Processing massbay_nocache
2015-02-11 16:43:34,693 - [DEBUG] Processing massbay_nocache
2015-02-11 16:43:34,693 - thredds_crawler - DEBUG - Processing massbay_nocache
2015-02-11 16:43:34,693 - [DEBUG] Processing massbay_nocache
2015-02-11 16:43:34,693 - thredds_crawler - DEBUG - Processing massbay_nocache
2015-02-11 16:43:34,693 - [DEBUG] Processing massbay_nocache
2015-02-11 16:43:34,693 - [DEBUG] Processing massbay_nocache
DEBUG:thredds_crawler:Processing massbay_nocache
2015-02-11 16:43:34,735 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:34,735 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
INFO:thredds_crawler:Downloading/Saving /usgs/data0/iso/iso_records/necofs1/gom3_nocache.iso.xml
2015-02-11 16:43:35,019 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,019 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
INFO:thredds_crawler:Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_met.iso.xml
2015-02-11 16:43:35,201 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,201 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
INFO:thredds_crawler:Downloading/Saving /usgs/data0/iso/iso_records/necofs1/necofs_gom3_wave.iso.xml
2015-02-11 16:43:35,354 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - thredds_crawler - INFO - Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
2015-02-11 16:43:35,354 - [INFO] Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml
INFO:thredds_crawler:Downloading/Saving /usgs/data0/iso/iso_records/necofs1/massbay_nocache.iso.xml

In [89]:
iso


Out[89]:
('massbay_nocache',
 'http://www.smast.umassd.edu:8080/thredds/iso/FVCOM/NECOFS/Forecasts/NECOFS_FVCOM_OCEAN_MASSBAY_FORECAST.nc?dataset=massbay_nocache&catalog=http%3A%2F%2Fwww.smast.umassd.edu%3A8080%2Fthredds%2Fforecasts.xml')

In [90]:
xml_url = iso[1]
tree = et.parse(xml_url)
print(et.tostring(tree, pretty_print=True))


<gmi:MI_Metadata xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gsr="http://www.isotc211.org/2005/gsr" xmlns:gss="http://www.isotc211.org/2005/gss" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:srv="http://www.isotc211.org/2005/srv" xsi:schemaLocation="http://www.isotc211.org/2005/gmi http://www.ngdc.noaa.gov/metadata/published/xsd/schema.xsd">
   <gmd:fileIdentifier>
      <gco:CharacterString>massbay_nocache</gco:CharacterString>
   </gmd:fileIdentifier>
   <gmd:language>
      <gmd:LanguageCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#LanguageCode" codeListValue="eng">eng</gmd:LanguageCode>
   </gmd:language>
   <gmd:characterSet>
      <gmd:MD_CharacterSetCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_CharacterSetCode" codeListValue="UTF8">UTF8</gmd:MD_CharacterSetCode>
   </gmd:characterSet>
   <gmd:hierarchyLevel>
      <gmd:MD_ScopeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset">dataset</gmd:MD_ScopeCode>
   </gmd:hierarchyLevel>
   <gmd:hierarchyLevel>
      <gmd:MD_ScopeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="service">service</gmd:MD_ScopeCode>
   </gmd:hierarchyLevel>
   <gmd:contact>
      <gmd:CI_ResponsibleParty>
         <gmd:individualName gco:nilReason="missing"/>
         <gmd:organisationName>
            <gco:CharacterString>School for Marine Science and Technology</gco:CharacterString>
         </gmd:organisationName>
         <gmd:contactInfo gco:nilReason="missing"/>
         <gmd:role>
            <gmd:CI_RoleCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
         </gmd:role>
      </gmd:CI_ResponsibleParty>
   </gmd:contact>
   <gmd:dateStamp>
      <gco:Date>2015-02-11</gco:Date>
   </gmd:dateStamp>
   <gmd:metadataStandardName>
      <gco:CharacterString>ISO 19115-2 Geographic Information - Metadata Part 2 Extensions for imagery and gridded data</gco:CharacterString>
   </gmd:metadataStandardName>
   <gmd:metadataStandardVersion>
      <gco:CharacterString>ISO 19115-2:2009(E)</gco:CharacterString>
   </gmd:metadataStandardVersion>
   <gmd:spatialRepresentationInfo>
      <gmd:MD_GridSpatialRepresentation>
         <gmd:numberOfDimensions>
            <gco:Integer>3</gco:Integer>
         </gmd:numberOfDimensions>
         <gmd:axisDimensionProperties>
            <gmd:MD_Dimension>
               <gmd:dimensionName>
                  <gmd:MD_DimensionNameTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_DimensionNameTypeCode" codeListValue="column">column</gmd:MD_DimensionNameTypeCode>
               </gmd:dimensionName>
               <gmd:dimensionSize gco:nilReason="unknown"/>
               <gmd:resolution>
                  <gco:Measure uom="degrees_east">1.4300389525366042E-5</gco:Measure>
               </gmd:resolution>
            </gmd:MD_Dimension>
         </gmd:axisDimensionProperties>
         <gmd:axisDimensionProperties>
            <gmd:MD_Dimension>
               <gmd:dimensionName>
                  <gmd:MD_DimensionNameTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_DimensionNameTypeCode" codeListValue="row">row</gmd:MD_DimensionNameTypeCode>
               </gmd:dimensionName>
               <gmd:dimensionSize gco:nilReason="unknown"/>
               <gmd:resolution>
                  <gco:Measure uom="degrees_north">1.4300389525366042E-5</gco:Measure>
               </gmd:resolution>
            </gmd:MD_Dimension>
         </gmd:axisDimensionProperties>
         <gmd:axisDimensionProperties>
            <gmd:MD_Dimension>
               <gmd:dimensionName>
                  <gmd:MD_DimensionNameTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_DimensionNameTypeCode" codeListValue="vertical">vertical</gmd:MD_DimensionNameTypeCode>
               </gmd:dimensionName>
               <gmd:dimensionSize>
                  <gco:Integer>10</gco:Integer>
               </gmd:dimensionSize>
               <gmd:resolution gco:nilReason="missing"/>
            </gmd:MD_Dimension>
         </gmd:axisDimensionProperties>
         <gmd:cellGeometry>
            <gmd:MD_CellGeometryCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_CellGeometryCode" codeListValue="area">area</gmd:MD_CellGeometryCode>
         </gmd:cellGeometry>
         <gmd:transformationParameterAvailability gco:nilReason="unknown"/>
      </gmd:MD_GridSpatialRepresentation>
   </gmd:spatialRepresentationInfo>
   <gmd:identificationInfo>
      <gmd:MD_DataIdentification id="DataIdentification">
         <gmd:citation>
            <gmd:CI_Citation>
               <gmd:title>
                  <gco:CharacterString>NECOFS Massachusetts (FVCOM) - Massachusetts Coastal - Latest Forecast</gco:CharacterString>
               </gmd:title>
               <gmd:date gco:nilReason="missing"/>
               <gmd:identifier>
                  <gmd:MD_Identifier>
                     <gmd:code>
                        <gco:CharacterString>massbay_nocache</gco:CharacterString>
                     </gmd:code>
                  </gmd:MD_Identifier>
               </gmd:identifier>
               <gmd:citedResponsibleParty>
                  <gmd:CI_ResponsibleParty>
                     <gmd:individualName gco:nilReason="missing"/>
                     <gmd:organisationName>
                        <gco:CharacterString>School for Marine Science and Technology</gco:CharacterString>
                     </gmd:organisationName>
                     <gmd:contactInfo gco:nilReason="missing"/>
                     <gmd:role>
                        <gmd:CI_RoleCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="originator">originator</gmd:CI_RoleCode>
                     </gmd:role>
                  </gmd:CI_ResponsibleParty>
               </gmd:citedResponsibleParty>
            </gmd:CI_Citation>
         </gmd:citation>
         <gmd:abstract>
            <gco:CharacterString>Latest forecast from the FVCOM Northeast Coastal Ocean Forecast System using high-resolution mesh covering the Massachusetts coastal region</gco:CharacterString>
         </gmd:abstract>
         <gmd:pointOfContact>
            <gmd:CI_ResponsibleParty>
               <gmd:individualName gco:nilReason="missing"/>
               <gmd:organisationName>
                  <gco:CharacterString>School for Marine Science and Technology</gco:CharacterString>
               </gmd:organisationName>
               <gmd:contactInfo gco:nilReason="missing"/>
               <gmd:role>
                  <gmd:CI_RoleCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
               </gmd:role>
            </gmd:CI_ResponsibleParty>
         </gmd:pointOfContact>
         <gmd:descriptiveKeywords>
            <gmd:MD_Keywords>
               <gmd:keyword>
                  <gco:CharacterString>sea_floor_depth_below_geoid</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>sea_surface_height_above_geoid</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>eastward_sea_water_velocity</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>northward_sea_water_velocity</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>upward_sea_water_velocity</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>barotropic_eastward_sea_water_velocity</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>barotropic_northward_sea_water_velocity</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>sea_water_potential_temperature</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>sea_water_salinity</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>longitude</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>latitude</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>longitude</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>latitude</gco:CharacterString>
               </gmd:keyword>
               <gmd:keyword>
                  <gco:CharacterString>ocean_sigma_coordinate</gco:CharacterString>
               </gmd:keyword>
               <gmd:type>
                  <gmd:MD_KeywordTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode" codeListValue="theme">theme</gmd:MD_KeywordTypeCode>
               </gmd:type>
               <gmd:thesaurusName>
                  <gmd:CI_Citation>
                     <gmd:title gco:nilReason="missing"/>
                     <gmd:date gco:nilReason="unknown"/>
                  </gmd:CI_Citation>
               </gmd:thesaurusName>
            </gmd:MD_Keywords>
         </gmd:descriptiveKeywords>
         <gmd:aggregationInfo>
            <gmd:MD_AggregateInformation>
               <gmd:aggregateDataSetIdentifier>
                  <gmd:MD_Identifier>
                     <gmd:authority>
                        <gmd:CI_Citation>
                           <gmd:title>
                              <gco:CharacterString>Unidata Common Data Model</gco:CharacterString>
                           </gmd:title>
                           <gmd:date gco:nilReason="inapplicable"/>
                        </gmd:CI_Citation>
                     </gmd:authority>
                     <gmd:code>
                        <gco:CharacterString>any</gco:CharacterString>
                     </gmd:code>
                  </gmd:MD_Identifier>
               </gmd:aggregateDataSetIdentifier>
               <gmd:associationType>
                  <gmd:DS_AssociationTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_AssociationTypeCode" codeListValue="largerWorkCitation">largerWorkCitation</gmd:DS_AssociationTypeCode>
               </gmd:associationType>
               <gmd:initiativeType>
                  <gmd:DS_InitiativeTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#DS_InitiativeTypeCode" codeListValue="project">project</gmd:DS_InitiativeTypeCode>
               </gmd:initiativeType>
            </gmd:MD_AggregateInformation>
         </gmd:aggregationInfo>
         <gmd:language>
            <gco:CharacterString>eng</gco:CharacterString>
         </gmd:language>
         <gmd:topicCategory>
            <gmd:MD_TopicCategoryCode>climatologyMeteorologyAtmosphere</gmd:MD_TopicCategoryCode>
         </gmd:topicCategory>
         <gmd:extent>
            <gmd:EX_Extent id="boundingExtent">
               <gmd:geographicElement>
                  <gmd:EX_GeographicBoundingBox id="boundingGeographicBoundingBox">
                     <gmd:extentTypeCode>
                        <gco:Boolean>1</gco:Boolean>
                     </gmd:extentTypeCode>
                     <gmd:westBoundLongitude>
                        <gco:Decimal>-71.19001007080078</gco:Decimal>
                     </gmd:westBoundLongitude>
                     <gmd:eastBoundLongitude>
                        <gco:Decimal>-69.3973159790039</gco:Decimal>
                     </gmd:eastBoundLongitude>
                     <gmd:southBoundLatitude>
                        <gco:Decimal>40.944496154785156</gco:Decimal>
                     </gmd:southBoundLatitude>
                     <gmd:northBoundLatitude>
                        <gco:Decimal>43.30540466308594</gco:Decimal>
                     </gmd:northBoundLatitude>
                  </gmd:EX_GeographicBoundingBox>
               </gmd:geographicElement>
               <gmd:temporalElement>
                  <gmd:EX_TemporalExtent id="boundingTemporalExtent">
                     <gmd:extent>
                        <gml:TimePeriod gml:id="d1007">
                           <gml:description>seconds</gml:description>
                           <gml:beginPosition>2015-02-08T00:00:00Z</gml:beginPosition>
                           <gml:endPosition>2015-02-14T00:00:00Z</gml:endPosition>
                        </gml:TimePeriod>
                     </gmd:extent>
                  </gmd:EX_TemporalExtent>
               </gmd:temporalElement>
            </gmd:EX_Extent>
         </gmd:extent>
      </gmd:MD_DataIdentification>
   </gmd:identificationInfo>
   <gmd:identificationInfo>
      <srv:SV_ServiceIdentification id="OPeNDAP">
         <gmd:citation>
            <gmd:CI_Citation>
               <gmd:title>
                  <gco:CharacterString>NECOFS Massachusetts (FVCOM) - Massachusetts Coastal - Latest Forecast</gco:CharacterString>
               </gmd:title>
               <gmd:date gco:nilReason="missing"/>
               <gmd:citedResponsibleParty>
                  <gmd:CI_ResponsibleParty>
                     <gmd:individualName gco:nilReason="missing"/>
                     <gmd:organisationName>
                        <gco:CharacterString>School for Marine Science and Technology</gco:CharacterString>
                     </gmd:organisationName>
                     <gmd:contactInfo gco:nilReason="missing"/>
                     <gmd:role>
                        <gmd:CI_RoleCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="originator">originator</gmd:CI_RoleCode>
                     </gmd:role>
                  </gmd:CI_ResponsibleParty>
               </gmd:citedResponsibleParty>
            </gmd:CI_Citation>
         </gmd:citation>
         <gmd:abstract>
            <gco:CharacterString>Latest forecast from the FVCOM Northeast Coastal Ocean Forecast System using high-resolution mesh covering the Massachusetts coastal region</gco:CharacterString>
         </gmd:abstract>
         <srv:serviceType>
            <gco:LocalName>THREDDS OPeNDAP</gco:LocalName>
         </srv:serviceType>
         <srv:extent>
            <gmd:EX_Extent>
               <gmd:geographicElement>
                  <gmd:EX_GeographicBoundingBox>
                     <gmd:extentTypeCode>
                        <gco:Boolean>1</gco:Boolean>
                     </gmd:extentTypeCode>
                     <gmd:westBoundLongitude>
                        <gco:Decimal>-71.19001007080078</gco:Decimal>
                     </gmd:westBoundLongitude>
                     <gmd:eastBoundLongitude>
                        <gco:Decimal>-69.3973159790039</gco:Decimal>
                     </gmd:eastBoundLongitude>
                     <gmd:southBoundLatitude>
                        <gco:Decimal>40.944496154785156</gco:Decimal>
                     </gmd:southBoundLatitude>
                     <gmd:northBoundLatitude>
                        <gco:Decimal>43.30540466308594</gco:Decimal>
                     </gmd:northBoundLatitude>
                  </gmd:EX_GeographicBoundingBox>
               </gmd:geographicElement>
               <gmd:temporalElement>
                  <gmd:EX_TemporalExtent>
                     <gmd:extent>
                        <gml:TimePeriod gml:id="d1007e48">
                           <gml:beginPosition>2015-02-08T00:00:00Z</gml:beginPosition>
                           <gml:endPosition>2015-02-14T00:00:00Z</gml:endPosition>
                        </gml:TimePeriod>
                     </gmd:extent>
                  </gmd:EX_TemporalExtent>
               </gmd:temporalElement>
            </gmd:EX_Extent>
         </srv:extent>
         <srv:couplingType>
            <srv:SV_CouplingType codeList="http://www.tc211.org/ISO19139/resources/codeList.xml#SV_CouplingType" codeListValue="tight">tight</srv:SV_CouplingType>
         </srv:couplingType>
         <srv:containsOperations>
            <srv:SV_OperationMetadata>
               <srv:operationName>
                  <gco:CharacterString>OPeNDAP Client Access</gco:CharacterString>
               </srv:operationName>
               <srv:DCP gco:nilReason="unknown"/>
               <srv:connectPoint>
                  <gmd:CI_OnlineResource>
                     <gmd:linkage>
                        <gmd:URL>http://www.smast.umassd.edu:8080/thredds/dodsC/FVCOM/NECOFS/Forecasts/NECOFS_FVCOM_OCEAN_MASSBAY_FORECAST.nc</gmd:URL>
                     </gmd:linkage>
                     <gmd:name>
                        <gco:CharacterString>OPeNDAP</gco:CharacterString>
                     </gmd:name>
                     <gmd:description>
                        <gco:CharacterString>THREDDS OPeNDAP</gco:CharacterString>
                     </gmd:description>
                     <gmd:function>
                        <gmd:CI_OnLineFunctionCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="download">download</gmd:CI_OnLineFunctionCode>
                     </gmd:function>
                  </gmd:CI_OnlineResource>
               </srv:connectPoint>
            </srv:SV_OperationMetadata>
         </srv:containsOperations>
         <srv:operatesOn xlink:href="#DataIdentification"/>
      </srv:SV_ServiceIdentification>
   </gmd:identificationInfo>
   <gmd:identificationInfo>
      <srv:SV_ServiceIdentification id="THREDDS_HTTP_Service">
         <gmd:citation>
            <gmd:CI_Citation>
               <gmd:title>
                  <gco:CharacterString>NECOFS Massachusetts (FVCOM) - Massachusetts Coastal - Latest Forecast</gco:CharacterString>
               </gmd:title>
               <gmd:date gco:nilReason="missing"/>
               <gmd:citedResponsibleParty>
                  <gmd:CI_ResponsibleParty>
                     <gmd:individualName gco:nilReason="missing"/>
                     <gmd:organisationName>
                        <gco:CharacterString>School for Marine Science and Technology</gco:CharacterString>
                     </gmd:organisationName>
                     <gmd:contactInfo gco:nilReason="missing"/>
                     <gmd:role>
                        <gmd:CI_RoleCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="originator">originator</gmd:CI_RoleCode>
                     </gmd:role>
                  </gmd:CI_ResponsibleParty>
               </gmd:citedResponsibleParty>
            </gmd:CI_Citation>
         </gmd:citation>
         <gmd:abstract>
            <gco:CharacterString>Latest forecast from the FVCOM Northeast Coastal Ocean Forecast System using high-resolution mesh covering the Massachusetts coastal region</gco:CharacterString>
         </gmd:abstract>
         <srv:serviceType>
            <gco:LocalName>THREDDS HTTP Service</gco:LocalName>
         </srv:serviceType>
         <srv:extent>
            <gmd:EX_Extent>
               <gmd:geographicElement>
                  <gmd:EX_GeographicBoundingBox>
                     <gmd:extentTypeCode>
                        <gco:Boolean>1</gco:Boolean>
                     </gmd:extentTypeCode>
                     <gmd:westBoundLongitude>
                        <gco:Decimal>-71.19001007080078</gco:Decimal>
                     </gmd:westBoundLongitude>
                     <gmd:eastBoundLongitude>
                        <gco:Decimal>-69.3973159790039</gco:Decimal>
                     </gmd:eastBoundLongitude>
                     <gmd:southBoundLatitude>
                        <gco:Decimal>40.944496154785156</gco:Decimal>
                     </gmd:southBoundLatitude>
                     <gmd:northBoundLatitude>
                        <gco:Decimal>43.30540466308594</gco:Decimal>
                     </gmd:northBoundLatitude>
                  </gmd:EX_GeographicBoundingBox>
               </gmd:geographicElement>
               <gmd:temporalElement>
                  <gmd:EX_TemporalExtent>
                     <gmd:extent>
                        <gml:TimePeriod gml:id="d1007e49">
                           <gml:beginPosition>2015-02-08T00:00:00Z</gml:beginPosition>
                           <gml:endPosition>2015-02-14T00:00:00Z</gml:endPosition>
                        </gml:TimePeriod>
                     </gmd:extent>
                  </gmd:EX_TemporalExtent>
               </gmd:temporalElement>
            </gmd:EX_Extent>
         </srv:extent>
         <srv:couplingType>
            <srv:SV_CouplingType codeList="http://www.tc211.org/ISO19139/resources/codeList.xml#SV_CouplingType" codeListValue="tight">tight</srv:SV_CouplingType>
         </srv:couplingType>
         <srv:containsOperations>
            <srv:SV_OperationMetadata>
               <srv:operationName>
                  <gco:CharacterString>FileHTTPService</gco:CharacterString>
               </srv:operationName>
               <srv:DCP gco:nilReason="unknown"/>
               <srv:connectPoint>
                  <gmd:CI_OnlineResource>
                     <gmd:linkage>
                        <gmd:URL>http://www.smast.umassd.edu:8080/thredds/fileServer/FVCOM/NECOFS/Forecasts/NECOFS_FVCOM_OCEAN_MASSBAY_FORECAST.nc</gmd:URL>
                     </gmd:linkage>
                     <gmd:name>
                        <gco:CharacterString>THREDDS_HTTP_Service</gco:CharacterString>
                     </gmd:name>
                     <gmd:description>
                        <gco:CharacterString>THREDDS HTTP Service</gco:CharacterString>
                     </gmd:description>
                     <gmd:function>
                        <gmd:CI_OnLineFunctionCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="download">download</gmd:CI_OnLineFunctionCode>
                     </gmd:function>
                  </gmd:CI_OnlineResource>
               </srv:connectPoint>
            </srv:SV_OperationMetadata>
         </srv:containsOperations>
         <srv:operatesOn xlink:href="#DataIdentification"/>
      </srv:SV_ServiceIdentification>
   </gmd:identificationInfo>
   <gmd:contentInfo>
      <gmi:MI_CoverageDescription>
         <gmd:attributeDescription gco:nilReason="unknown"/>
         <gmd:contentType gco:nilReason="unknown"/>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>x</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>nodal x-coordinate</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#meters"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>y</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>nodal y-coordinate</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#meters"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>xc</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>zonal x-coordinate</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#meters"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>yc</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>zonal y-coordinate</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#meters"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>h</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>Bathymetry (sea_floor_depth_below_geoid)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#m"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>nv</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>int</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>nodes surrounding element</gco:CharacterString>
               </gmd:descriptor>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>Times</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>char</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString/>
               </gmd:descriptor>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>zeta</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>Water Surface Elevation (sea_surface_height_above_geoid)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#meters"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>nbe</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>int</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>elements surrounding each element</gco:CharacterString>
               </gmd:descriptor>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>aw0</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>aw0</gco:CharacterString>
               </gmd:descriptor>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>awx</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>awx</gco:CharacterString>
               </gmd:descriptor>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>awy</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>awy</gco:CharacterString>
               </gmd:descriptor>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>u</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>Eastward Water Velocity (eastward_sea_water_velocity)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#meters%20s-1"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>v</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>Northward Water Velocity (northward_sea_water_velocity)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#meters%20s-1"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>ww</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>Upward Water Velocity (upward_sea_water_velocity)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#meters%20s-1"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>ua</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>Vertically Averaged x-velocity (barotropic_eastward_sea_water_velocity)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#meters%20s-1"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>va</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>Vertically Averaged y-velocity (barotropic_northward_sea_water_velocity)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#meters%20s-1"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>temp</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>temperature (sea_water_potential_temperature)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#degrees_C"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>salinity</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>salinity (sea_water_salinity)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#1"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>fvcom_mesh</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>int</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString/>
               </gmd:descriptor>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>lon</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>nodal longitude (longitude)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#degrees_east"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>lat</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>nodal latitude (latitude)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#degrees_north"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>lonc</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>zonal longitude (longitude)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#degrees_east"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>latc</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>zonal latitude (latitude)</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#degrees_north"/>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>siglay</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>Sigma Layers (ocean_sigma_coordinate)</gco:CharacterString>
               </gmd:descriptor>
            </gmd:MD_Band>
         </gmd:dimension>
         <gmd:dimension>
            <gmd:MD_Band>
               <gmd:sequenceIdentifier>
                  <gco:MemberName>
                     <gco:aName>
                        <gco:CharacterString>time</gco:CharacterString>
                     </gco:aName>
                     <gco:attributeType>
                        <gco:TypeName>
                           <gco:aName>
                              <gco:CharacterString>float</gco:CharacterString>
                           </gco:aName>
                        </gco:TypeName>
                     </gco:attributeType>
                  </gco:MemberName>
               </gmd:sequenceIdentifier>
               <gmd:descriptor>
                  <gco:CharacterString>time</gco:CharacterString>
               </gmd:descriptor>
               <gmd:units xlink:href="http://example.org/someUnitsDictionary.xml#days%20since%201858-11-17%2000%3A00%3A00"/>
            </gmd:MD_Band>
         </gmd:dimension>
      </gmi:MI_CoverageDescription>
   </gmd:contentInfo>
   <gmd:distributionInfo>
      <gmd:MD_Distribution>
         <gmd:distributor>
            <gmd:MD_Distributor>
               <gmd:distributorContact gco:nilReason="missing"/>
               <gmd:distributorFormat>
                  <gmd:MD_Format>
                     <gmd:name>
                        <gco:CharacterString>OPeNDAP</gco:CharacterString>
                     </gmd:name>
                     <gmd:version gco:nilReason="unknown"/>
                  </gmd:MD_Format>
               </gmd:distributorFormat>
               <gmd:distributorTransferOptions>
                  <gmd:MD_DigitalTransferOptions>
                     <gmd:onLine>
                        <gmd:CI_OnlineResource>
                           <gmd:linkage>
                              <gmd:URL>http://www.smast.umassd.edu:8080/thredds/dodsC/FVCOM/NECOFS/Forecasts/NECOFS_FVCOM_OCEAN_MASSBAY_FORECAST.nc.html</gmd:URL>
                           </gmd:linkage>
                           <gmd:name>
                              <gco:CharacterString>File Information</gco:CharacterString>
                           </gmd:name>
                           <gmd:description>
                              <gco:CharacterString>This URL provides a standard OPeNDAP html interface for selecting data from this dataset. Change the extension to .info for a description of the dataset.</gco:CharacterString>
                           </gmd:description>
                           <gmd:function>
                              <gmd:CI_OnLineFunctionCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="download">download</gmd:CI_OnLineFunctionCode>
                           </gmd:function>
                        </gmd:CI_OnlineResource>
                     </gmd:onLine>
                  </gmd:MD_DigitalTransferOptions>
               </gmd:distributorTransferOptions>
               <gmd:distributorTransferOptions>
                  <gmd:MD_DigitalTransferOptions>
                     <gmd:onLine>
                        <gmd:CI_OnlineResource>
                           <gmd:linkage>
                              <gmd:URL>http://www.ncdc.noaa.gov/oa/wct/wct-jnlp-beta.php?singlefile=http://www.smast.umassd.edu:8080/thredds/dodsC/FVCOM/NECOFS/Forecasts/NECOFS_FVCOM_OCEAN_MASSBAY_FORECAST.nc</gmd:URL>
                           </gmd:linkage>
                           <gmd:name>
                              <gco:CharacterString>Viewer Information</gco:CharacterString>
                           </gmd:name>
                           <gmd:description>
                              <gco:CharacterString>This URL provides an NCDC climate and weather toolkit view of an OPeNDAP resource.</gco:CharacterString>
                           </gmd:description>
                           <gmd:function>
                              <gmd:CI_OnLineFunctionCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_PresentationFormCode" codeListValue="mapDigital">mapDigital</gmd:CI_OnLineFunctionCode>
                           </gmd:function>
                        </gmd:CI_OnlineResource>
                     </gmd:onLine>
                  </gmd:MD_DigitalTransferOptions>
               </gmd:distributorTransferOptions>
            </gmd:MD_Distributor>
         </gmd:distributor>
      </gmd:MD_Distribution>
   </gmd:distributionInfo>
   <gmd:dataQualityInfo>
      <gmd:DQ_DataQuality>
         <gmd:scope>
            <gmd:DQ_Scope>
               <gmd:level>
                  <gmd:MD_ScopeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset">dataset</gmd:MD_ScopeCode>
               </gmd:level>
            </gmd:DQ_Scope>
         </gmd:scope>
         <gmd:lineage>
            <gmd:LI_Lineage>
               <gmd:statement>
                  <gco:CharacterString>Wed Feb 11 09:05:55 2015: ncrcat -O -v x,y,lat,lon,xc,yc,lonc,latc,siglay,siglev,nv,nbe,aw0,awx,awy,h,temp,salinity,u,v,ww,ua,va,zeta,Times -d time,3840,3984 /data01/necofs/FVCOM/output_mbn_layer11/mbn_0001.nc -o /data01/necofs/NECOFS_ARCHIVES/NECOFS_FVCOM_OCEAN_MASSBAY_FORECAST.nc
Thu Sep 18 10:34:18 2014: ncrcat -d time,5832,6312 mbn_hot_0001.nc mbn_hot_0002.nc
Thu Jan  9 13:24:19 2014: ncrcat -d time,6600,6864 mbn_hot_0001.nc mbn_hot_0001_1.nc
Fri Apr  5 10:31:42 2013: ncrcat -d time,8112,8280 mbn_hot_0001.nc mbn_hot_0001_1.nc
Tue May  1 11:24:29 2012: ncrcat mbn_hot_0003.nc mbn_hot_0002.nc mbn_hot_0004.nc
Tue May  1 11:23:08 2012: ncrcat -d time,11184,11187 mbn_hot_0001.nc mbn_hot_0003.nc
model started at: 19/01/2011   08:26</gco:CharacterString>
               </gmd:statement>
            </gmd:LI_Lineage>
         </gmd:lineage>
      </gmd:DQ_DataQuality>
   </gmd:dataQualityInfo>
   <gmd:metadataMaintenance>
      <gmd:MD_MaintenanceInformation>
         <gmd:maintenanceAndUpdateFrequency gco:nilReason="unknown"/>
         <gmd:maintenanceNote>
            <gco:CharacterString>This record was translated from NcML using UnidataDD2MI.xsl Version 2.3</gco:CharacterString>
         </gmd:maintenanceNote>
      </gmd:MD_MaintenanceInformation>
   </gmd:metadataMaintenance>
</gmi:MI_Metadata>


In [91]:
namespace = {'gco': 'http://www.isotc211.org/2005/gco',
             'gmd': 'http://www.isotc211.org/2005/gmd'
             }
#cmg_portal = tree.findall(".//gmd:keyword[gco:CharacterString='CMG_Portal']/gco:CharacterString", namespace)
cmg_portal = tree.xpath(".//gco:CharacterString[text()='CMG_Portal']", namespaces=namespace)
print(cmg_portal)


[]

In [96]:
if not cmg_portal:
    print 'empty'


empty

In [97]:
cmg_portal = tree.xpath(".//gmd:URL[contains(text(), 'thredds/wms')]", namespaces=namespace)
print(cmg_portal[0].text)


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-97-5e2d2d2aa823> in <module>()
      1 cmg_portal = tree.xpath(".//gmd:URL[contains(text(), 'thredds/wms')]", namespaces=namespace)
----> 2 print(cmg_portal[0].text)

IndexError: list index out of range

In [ ]:
wms_url = cmg_portal[0].text
name = wms_url.split('/')[-1].replace('-','_').replace('.','?').split('?')[0]
print(name)

In [ ]:
new_wms_url = 'http://geoport.whoi.edu:8899/wms/datasets/{0}/?REQUEST=GetCapabilities'.format(name)
print(new_wms_url)

In [ ]:
cmg_portal[0].text = new_wms_url

In [ ]:
print(et.tostring(tree, pretty_print=True))

In [ ]:
with open('somefile.xml', 'w') as f:
    f.write(et.tostring(tree, pretty_print=True))

In [ ]: