Compress pickled object
This commit is contained in:
parent
3d2b20a9a1
commit
1114754da4
3 changed files with 12 additions and 16 deletions
|
|
@ -1,8 +1,10 @@
|
|||
import argparse
|
||||
import gzip
|
||||
import configparser
|
||||
import logging
|
||||
import pathlib
|
||||
import pickle
|
||||
from time import time
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
|
@ -22,8 +24,8 @@ log = logging.getLogger("ola_post")
|
|||
log.info("Starting sws -> olaFlow converter")
|
||||
config = configparser.ConfigParser()
|
||||
config.read(args.config)
|
||||
out = pathlib.Path(config.get("post", "pickle"))
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
out = pathlib.Path(config.get("post", "out"))
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
olaflow_root = args.output
|
||||
model = OFModel(olaflow_root)
|
||||
|
|
@ -35,5 +37,5 @@ model.read_field_all("p")
|
|||
model.read_field_all("p_rgh")
|
||||
model.read_field_all("U")
|
||||
|
||||
with out.open("wb") as f:
|
||||
with gzip.open(out.joinpath("pickle.gz"), "wb") as f:
|
||||
pickle.dump(model, f)
|
||||
|
|
|
|||
Reference in a new issue