pretrain-predict: params.json → metadata.jsonl

This commit is contained in:
Starbeamrainbowlabs 2022-09-28 16:35:22 +01:00
parent e9e6139c7a
commit d618e6f8d7
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -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()
}))