Merge fgmax results

From short run with 3 second updating and long run with 20 second updating

In [1]:
%matplotlib inline
In [2]:
from pylab import *
from clawpack.geoclaw import topotools
from clawpack.visclaw import geoplot, plottools
In [3]:
import nc_tools
import os,sys,copy
In [4]:
loc = 'LaPush'
event = 'CSZ_L1'
fgmax_file1 = '../Runs/%s/%s_v570/results_%s_%s_8hr_20s.nc' % (loc,event,loc,event)
fgmax_file2 = '../Runs/%s/%s_v570/results_%s_%s_2hr_3s.nc' % (loc,event,loc,event)
In [5]:
fgmax1 = nc_tools.read_nc(fgmax_file1)
Reading data to fg from nc file ../Runs/LaPush/CSZ_L1_v570/results_LaPush_CSZ_L1_8hr_20s.nc
        nc file description:  fgmax data for 
History:   Created with input data Thu Aug  6 08:43:24 2020 in /Users/rjl/git/WA_EMD_2020/topo;  Added output Thu Aug  6 10:15:34 2020 in /projects/rale6846/WA_EMD_2020/Runs/LaPush/CSZ_L1_v570;  
    Loaded lon as fg.x
    Loaded lat as fg.y
    Constructed fg.X and fg.Y
    Loaded Z as fg.Z
    Loaded dz as fg.dz
    Did not find force_dry_init for fg.force_dry_init
    Loaded fgmax_point as fg.fgmax_point
    Loaded B as fg.B
    Loaded h as fg.h
    Loaded s as fg.s
    Loaded hss as fg.hss
    Loaded hmin as fg.hmin
    Loaded arrival_time as fg.arrival_time
Returning FGmaxGrid object
In [6]:
fgmax2 = nc_tools.read_nc(fgmax_file2)
Reading data to fg from nc file ../Runs/LaPush/CSZ_L1_v570/results_LaPush_CSZ_L1_2hr_3s.nc
        nc file description:  fgmax data for 
History:   Created with input data Thu Aug  6 08:43:24 2020 in /Users/rjl/git/WA_EMD_2020/topo;  Added output Sat Aug 22 04:08:05 2020 in /projects/rale6846/WA_EMD_2020/Runs/LaPush/CSZ_L1_v570;  
    Loaded lon as fg.x
    Loaded lat as fg.y
    Constructed fg.X and fg.Y
    Loaded Z as fg.Z
    Loaded dz as fg.dz
    Did not find force_dry_init for fg.force_dry_init
    Loaded fgmax_point as fg.fgmax_point
    Loaded B as fg.B
    Loaded h as fg.h
    Loaded s as fg.s
    Loaded hss as fg.hss
    Loaded hmin as fg.hmin
    Loaded arrival_time as fg.arrival_time
Returning FGmaxGrid object
In [7]:
print('max difference in B = %g' % abs(fgmax1.B - fgmax2.B).max())
print('max difference in dz = %g' % abs(fgmax1.dz - fgmax2.dz).max())
max difference in B = 0
max difference in dz = 0
In [8]:
print('minimum change in h = %.2f m' % (fgmax1.h - fgmax2.h).min())
print('maximum change in h = %.2f m' % (fgmax1.h - fgmax2.h).max())
minimum change in h = -13.56 m
maximum change in h = 7.58 m
In [9]:
print('minimum change in s = %.2f m/s' % (fgmax1.s - fgmax2.s).min())
print('maximum change in s = %.2f m/s' % (fgmax1.s - fgmax2.s).max())
minimum change in s = -23.10 m/s
maximum change in s = 6.93 m/s
In [10]:
figure(figsize=(13,13))
plottools.pcolorcells(fgmax1.X, fgmax1.Y, fgmax1.s - fgmax2.s, cmap=cm.get_cmap('seismic'))
clim(-10,10)
colorbar(shrink=0.7, extend='both')
contour(fgmax1.X, fgmax1.Y, fgmax1.B, [0], colors='g', linewidths=0.5)
gca().set_aspect(1./cos(48*pi/180))
title('Difference in s (old - new)');
In [11]:
figure(figsize=(13,13))
plottools.pcolorcells(fgmax1.X, fgmax1.Y, fgmax1.h - fgmax2.h, cmap=cm.get_cmap('seismic'))
clim(-10,10)
colorbar(shrink=0.7, extend='both')
contour(fgmax1.X, fgmax1.Y, fgmax1.B, [0], colors='g', linewidths=0.5)
gca().set_aspect(1./cos(48*pi/180))
title('Difference in h (old - new)');
In [12]:
fgmax_file3 = '../Runs/%s/%s_v570/results_%s_%s_merged.nc' % (loc,event,loc,event)
os.system('cp %s %s' % (fgmax_file2, fgmax_file3))
Out[12]:
0
In [13]:
fgmax3 = copy.copy(fgmax2)
In [14]:
fgmax3.h = maximum(fgmax1.h, fgmax2.h)
fgmax3.s = maximum(fgmax1.s, fgmax2.s)
fgmax3.hss = maximum(fgmax1.hss, fgmax2.hss)
fgmax3.hmin = minimum(fgmax1.hmin, fgmax2.hmin)
In [15]:
nc_tools.write_nc_output(fgmax_file3, fgmax3, new=False, force=True)
/Users/rjl/git/WA_EMD_2020/common_python
Appending data from fg to nc file ../Runs/LaPush/CSZ_L1_v570/results_LaPush_CSZ_L1_merged.nc
        nc file description:  fgmax data for 
        fg.id:  
    Adding fg.dz to nc file
    Adding fg.B to nc file
    Adding fg.h to nc file
    Adding fg.s to nc file
    Adding fg.hss to nc file
    Adding fg.hmin to nc file
    Adding fg.arrival_time to nc file
Created ../Runs/LaPush/CSZ_L1_v570/results_LaPush_CSZ_L1_merged.nc
History:   Created with input data Thu Aug  6 08:43:24 2020 in /Users/rjl/git/WA_EMD_2020/topo;  Added output Sat Aug 22 04:08:05 2020 in /projects/rale6846/WA_EMD_2020/Runs/LaPush/CSZ_L1_v570;  Added output Sun Aug 23 11:16:49 2020 in /Users/rjl/git/WA_EMD_2020/common_python;  

Metadata:
  outdir:   /Users/rjl/git/WA_EMD_2020/common_python/Unknown
  run_finished:   Unknown
  tfinal:   -9999.0
In [ ]: