from parameters import Param import matplotlib.pyplot as plt from utils import make_gif, make_plot from time import time from pathlib import Path import sys PATH = sys.argv[1] if len(sys.argv) == 2 else str(Path(__file__).parent.absolute())[:-3]+'imgs/' NAME = 'huge' fst = Param( CLUSTERS = 12**2, CLUST_SIDE_LEN = 7, DAYS = 100, INFECTION_TIME = 20, DEATH_RATE = 0.4, INFECT_RATE = 0.3, MIGRATIONS_PER_DAY = 100, FEAR_RATE = 0.4, HEALTHCARE_CAPACITY = 2500 ) start = time() cumulative, active, healed, dead, migrations, real_mig = run_simulation(fst, PATH) print('time elapsed:', time() - start, flush=True) make_gif(PATH, NAME) # plt.plot(range(len(migrations)), migrations, label='migrations', color='blue') plt.plot(range(len(real_mig)), real_mig, label='migrations', color='blue', ls=':')
from parameters import Param import rgdf import matplotlib.pyplot as plt import time import glob import schwimmbad import numpy as np from netCDF4 import Dataset import iotools import datetime plt.ion() # load the paragridded parameters param = Param() param.dirgigabin = "/ccc/store/cont003/gch0401/gch0401/GIGATL1_1h_tides/BIN_1h_JG" param.dirgrid = "/ccc/scratch/cont003/ra4735/gulaj/GIGATL1/INIT_N100_100_100/GRD3" param.dirgrid = "/ccc/scratch/cont003/gen12051/groullet/giga/GRD" # setup readers rgdf.setup_predefine_readers(param) # list of tiles in region 7 reg7 = [t for t, r in param.subdmap.items() if r == 7] def get_alldates(datadir, subd): """ return the dates converted into dat file""" files = glob.glob(f"{datadir}/{subd:02}/*.dat")
""" Tools to manage the RGDF database """ from parameters import Param import rgdf import glob param = Param() def get_whatisdone(param, subd): """ return the list of dates that are completed in region subd """ pattern = f"{param.dirgigabin}/{subd:02}/giga_*_{subd:02}.dat" files = glob.glob(pattern) dates = [f.split("/")[-1].split("_")[1] for f in files] return dates def scan_all(param): dates = {} for subd in range(1, 14): dates[subd] = get_whatisdone(param, subd) return dates
import os import sys import tensorflow as tf from parameters import Param from src.model.model import Net # Obtain parameters args = Param() os.environ["CUDA_VISIBLE_DEVICES"] = "1" def main(_): Net_model = Net gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=1.0) config = tf.ConfigProto(gpu_options=gpu_options) config.gpu_options.allow_growth = True with tf.Session(config=config) as sess: model = Net_model(sess, args) if __name__ == '__main__': tf.app.run()
from parameters import Param import giga_subdomains as gs import datetime as dt import dates import ncconvert import migration param = Param() # Region 1 (Gulf Stream separation): 78W-68W, 30N-40N; dom = ((-78, 30), (-68, 40)) # Region 2 (Gulf Stream extension): 54W-44W, 30N-40N dom = ((-54, 30), (-44, 40)) domain = gs.LLTR2domain(*dom) tiles = gs.find_tiles_inside(param, domain) subds = [param.subdmap[t] for t in tiles] print(set(subds)) # Pour les périodes: # # Aug., Sep. and Oct. 2008 # Feb., Mar. and Apr. 2009 d0 = dt.datetime(2008, 8, 1, 0) d1 = dt.datetime(2008, 11, 1, 0) d0 = dt.datetime(2009, 2, 1, 0) d1 = dt.datetime(2009, 5, 1, 0) hisdates = dates.daterange(d0, d1, dates.day)