-
Notifications
You must be signed in to change notification settings - Fork 1
/
tf_imports.py
52 lines (46 loc) · 1.39 KB
/
tf_imports.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""
Just all the imports for all other scripts and notebooks.
"""
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
#import keras
import tensorflow as tf
from tensorflow.keras.callbacks import *
import tensorflow as tf
import pandas as pd
import pickle
import pdb
import netCDF4 as nc
import xarray as xr
import h5py
from glob import glob
import sys, os
import seaborn as sns
from tf_losses import *
#from .models import PartialReLU, QLayer, ELayer
from tf_models import PartialReLU, QLayer, ELayer
#from tensorflow.keras.utils.generic_utils import get_custom_objects
from tensorflow.python.keras.utils import get_custom_objects
metrics_dict = dict([(f.__name__, f) for f in all_metrics])
get_custom_objects().update(metrics_dict)
get_custom_objects().update({
'PartialReLU': PartialReLU,
'QLayer': QLayer,
'ELayer': ELayer,
})
from configargparse import ArgParser
from ipykernel.kernelapp import IPKernelApp
def in_notebook(): return IPKernelApp.initialized()
if in_notebook():
from tqdm import tqdm
else:
from tqdm import tqdm_notebook as tqdm
L_V = 2.501e6 # Latent heat of vaporization
L_I = 3.337e5 # Latent heat of freezing
L_S = L_V + L_I # Sublimation
C_P = 1.00464e3 # Specific heat capacity of air at constant pressure
G = 9.80616
P0 = 1e5
with open(os.path.join(os.path.dirname(__file__), 'hyai_hybi.pkl'), 'rb') as f:
hyai, hybi = pickle.load(f)