mirror of
https://github.com/sbrl/research-rainfallradar
synced 2024-11-25 18:33:01 +00:00
read_metadata: support file inputs as well as dirs
This commit is contained in:
parent
aa7d9b8cf6
commit
0aa2ce19f5
1 changed files with 4 additions and 1 deletions
|
@ -5,6 +5,9 @@ import json
|
||||||
from ..io.readfile import readfile
|
from ..io.readfile import readfile
|
||||||
|
|
||||||
def read_metadata(dirpath_dataset):
|
def read_metadata(dirpath_dataset):
|
||||||
filepath_metadata = os.path.join(dirpath_dataset, "metadata.json")
|
if os.path.isfile(dirpath_dataset):
|
||||||
|
filepath_metadata = os.path.join(os.path.dirname(dirpath_dataset), "metadata.jsonl")
|
||||||
|
else:
|
||||||
|
filepath_metadata = os.path.join(dirpath_dataset, "metadata.json")
|
||||||
|
|
||||||
return json.loads(readfile(filepath_metadata))
|
return json.loads(readfile(filepath_metadata))
|
Loading…
Reference in a new issue