#!/usr/bin/env python # read config import ConfigParser from configurator import read_config,config from baltrad_wms import get_query_layer settings = read_config(tools=True) online_resource = settings["online_resource"] tmpdir = settings["tmpdir"] from db_setup import * import cgi import os import StringIO from urllib import urlopen from xml.etree import ElementTree import zipfile import tempfile from pyproj import Proj, transform kmz_image_width = 600 kml_namespace = "http://www.opengis.net/kml/2.2" # else: # bbox_lonlat = None def download_geotiff(): timestamp = pars["TIME"].value time_object = datetime.strptime(timestamp,"%Y-%m-%dT%H:%M:00Z") layer_name = pars["LAYER"].value radar_dataset = session.query(RadarDataset)\
#!/usr/bin/env python # read config from configurator import read_config settings = read_config() from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base from datetime import datetime engine = create_engine(settings["db_uri"], echo=False) Session = sessionmaker(bind=engine) session = Session() metadata = MetaData(engine) Base = declarative_base(metadata=metadata) class RadarDataset(Base): __tablename__ = "radar_dataset" id = Column(Integer, primary_key=True) name = Column(String(50), nullable=False) title = Column(String(300), nullable=False) timestamp = Column(DateTime, index=True) geotiff_path = Column(String(500), nullable=False) hdf_path = Column(String(500)) projdef = Column(String(150)) bbox_original = Column(String(150)) unit = Column(String(100), nullable=False) dataset_type = Column(String(10)) style = Column(String(50))
from src.pipeline import NLUDataset from src.utils import make_dir, save_train_log, save_ckpt, load_ckpt from src.train import train_1epoch from src.evaluate import evaluate #%% Input args # Run this file in background: nohup python main.py --config_fname=sample > log_sample.txt & parser = argparse.ArgumentParser() parser.add_argument('--config_fname', type=str, default='sample') parser.add_argument('--overwrite', type=bool, default=True) args = parser.parse_args() #%% CONFIG_FNAME = args.config_fname try: experiment_configs = read_config(CONFIG_FNAME) except ValueError as e: print('There is no such configure file!') RESULT_ROOT_DIR = make_dir('../results', CONFIG_FNAME, overwrite=args.overwrite) #%% def main(config): CASE_NUM = config['case_num'] DATASET = config['dataset'] NORMALIZATION = config['normalization']