From 7fd565ae272caf50bb235a578232c843b4f38e93 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 1 Nov 2023 10:14:28 -0700 Subject: [PATCH] use current cf names --- harvester/cde_harvester/utils.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/harvester/cde_harvester/utils.py b/harvester/cde_harvester/utils.py index f3fd9c77..33129400 100644 --- a/harvester/cde_harvester/utils.py +++ b/harvester/cde_harvester/utils.py @@ -53,14 +53,19 @@ def intersection(lst1, lst2): def flatten(t): return [item for sublist in t for item in sublist] +def get_cf_names(): + cf_names_xml_url="https://cfconventions.org/Data/cf-standard-names/current/src/cf-standard-name-table.xml" -cf_standard_names = ( - pd.read_xml( - "https://cfconventions.org/Data/cf-standard-names/78/src/cf-standard-name-table.xml" + print ("Downloading", cf_names_xml_url) + + cf_standard_names = ( + pd.read_xml(cf_names_xml_url) + .sort_values(by="id")["id"] + .unique() ) - .sort_values(by="id")["id"] - .unique() -) + return cf_standard_names + +cf_standard_names = get_cf_names() # list of standard names that are supported by CDE supported_standard_names = flatten(cde_eov_to_standard_name.values())