mirror of
https://github.com/sbrl/research-rainfallradar
synced 2024-11-25 10:32:59 +00:00
pretrain-predict: params.json → metadata.jsonl
This commit is contained in:
parent
e9e6139c7a
commit
d618e6f8d7
1 changed files with 5 additions and 5 deletions
|
@ -79,16 +79,16 @@ def run(args):
|
|||
write_mode = "wb"
|
||||
|
||||
handle = sys.stdout
|
||||
filepath_params = None
|
||||
filepath_metadata = None
|
||||
if filepath_output != "-":
|
||||
handle = handle_open(
|
||||
filepath_output if args.records_per_file <= 0 else filepath_output.replace("+d", str(0)),
|
||||
write_mode
|
||||
)
|
||||
filepath_params = os.path.join(os.path.dirname(filepath_output), "params.json")
|
||||
filepath_metadata = os.path.join(os.path.dirname(filepath_output), "metadata.json")
|
||||
|
||||
logger.info(f"filepath_output: {filepath_output}")
|
||||
logger.info(f"filepath_params: {filepath_params}")
|
||||
logger.info(f"filepath_params: {filepath_metadata}")
|
||||
|
||||
i = 0
|
||||
i_file = i
|
||||
|
@ -104,8 +104,8 @@ def run(args):
|
|||
if output_mode == MODE_JSONL:
|
||||
handle.write(json.dumps(step_rainfall.numpy().tolist(), separators=(',', ':'))+"\n") # Ref https://stackoverflow.com/a/64710892/1460422
|
||||
elif output_mode == MODE_TFRECORD:
|
||||
if i == 0 and filepath_params is not None:
|
||||
writefile(filepath_params, json.dumps({
|
||||
if i == 0 and filepath_metadata is not None:
|
||||
writefile(filepath_metadata, json.dumps({
|
||||
"rainfallradar": step_rainfall.shape.as_list(),
|
||||
"waterdepth": step_water.shape.as_list()
|
||||
}))
|
||||
|
|
Loading…
Reference in a new issue