Skip to content

Commit

Permalink
unescape organization names from erddap
Browse files Browse the repository at this point in the history
Fixes #398
  • Loading branch information
n-a-t-e committed Mar 24, 2023
1 parent 275c065 commit edde7cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions harvester/cde_harvester/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
import queue
import numpy as np
import pandas as pd
from cde_harvester.ckan.create_ckan_erddap_link import get_ckan_records, unescape_ascii
from cde_harvester.ckan.create_ckan_erddap_link import (
get_ckan_records,
unescape_ascii,
unescape_ascii_list,
)
from cde_harvester.harvest_erddap import harvest_erddap
from cde_harvester.utils import (
cf_standard_names,
Expand Down Expand Up @@ -134,7 +138,8 @@ def worker():

# prioritize with organizations from CKAN and then pull ERDDAP if needed
datasets["organizations"] = datasets.apply(
lambda x: x["ckan_organizations"] or x["organizations"], axis=1
lambda x: x["ckan_organizations"] or unescape_ascii_list(x["organizations"]),
axis=1,
)
del datasets["title"]
# del datasets["summary"]
Expand Down
2 changes: 2 additions & 0 deletions harvester/cde_harvester/ckan/create_ckan_erddap_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def split_erddap_url(url):
dataset_id = f.split(".html")[0]
return (erddap_host, dataset_id)

def unescape_ascii_list(l):
return [unescape_ascii(x) for x in l]

def unescape_ascii(x):
try:
Expand Down

0 comments on commit edde7cc

Please sign in to comment.