Commit f8061ef8 authored by Pierre Dittgen's avatar Pierre Dittgen

Fix observation values as string

parent 0f878ac7
......@@ -149,6 +149,9 @@ def generate_series_jsonl(ds_dir, csv_data_content, zi_col, zi_type, base_time_s
unit_info_set = set()
dim_list = None
def norm_obs(obs_val):
return obs_val if obs_val == 'NA' else float(obs_val)
series_jsonl_filepath = ds_dir / 'series.jsonl'
with series_jsonl_filepath.open("wt", encoding="utf-8") as fdout:
ts_list = []
......@@ -182,7 +185,8 @@ def generate_series_jsonl(ds_dir, csv_data_content, zi_col, zi_type, base_time_s
},
'observations': [
("PERIOD", "VALUE"),
*zip(map(str, subdf['period'].tolist()), subdf[i].fillna('NA').tolist())
*zip(subdf['period'].tolist(),
map(norm_obs, subdf[i].fillna('NA').tolist()))
]
}
ts_list.append(time_series)
......@@ -467,7 +471,7 @@ def generate_dataset_data(target_dir, ds_code, structure_info, datacube_filepath
def rebuild_category_tree(target_dir):
"""Read datasets dataset.json files, extract datasets (code, name) and rebuild category tree"""
log.info("Read dataset info from dataset.json files...")
dataset_info_list = []
for ds_dir in (f for f in target_dir.glob('*') if f.is_dir()):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment