Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update standard names URL #997

Merged
merged 2 commits into from
Mar 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions compliance_checker/cf/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pkgutil import get_data
from urllib.parse import urljoin

import lxml.html
import requests
from cf_units import Unit
from lxml import etree
Expand Down Expand Up @@ -430,16 +429,7 @@ def download_cf_standard_name_table(version, location=None):
)

if version == "latest":
tables_tree = lxml.html.parse("http://cfconventions.org/documents.html")
end_str = "cf-standard-name-table.xml"
xpath_expr = (
"//a[substring(@href, string-length(@href) - "
"string-length('{0}') +1) "
" = '{0}'][1]".format(end_str)
)
latest_vers = tables_tree.xpath(xpath_expr)[0]

url = urljoin("http://cfconventions.org", latest_vers.attrib["href"])
url = "http://cfconventions.org/Data/cf-standard-names/current/src/cf-standard-name-table.xml"
else:
url = "http://cfconventions.org/Data/cf-standard-names/{0}/src/cf-standard-name-table.xml".format(
version
Expand Down