Ejemplo n.º 1
0
from diagnostic_reading import Meridional_Slice

dirname = sys.argv[1]
radatadir = dirname + '/Meridional_Slices/'

datadir = dirname + '/data/'
if (not os.path.isdir(datadir)):
    os.makedirs(datadir)

files = os.listdir(radatadir)
nfiles = len(files)
files.sort()

#times,dtimes,weights = np.load(datadir + 'mer_times.npy')

mer0 = Meridional_Slice(radatadir + files[0], '')
nr = mer0.nr
nt = mer0.ntheta

vavg = np.load(datadir + 'vavg.npy')
vr_av = vavg[0]

# make 100 bins for vr in the range [-300 m/s, 200 m/s]
nbins = 100
binedges = np.linspace(-300., 200., nbins + 1)
minvr = np.min(binedges)
maxvr = np.max(binedges)

counts = np.zeros((nt, nr, nbins))

for ii in range(nfiles):
Ejemplo n.º 2
0
vr_vp_dist_df = np.zeros((nt, nr, nbins_vr, nbins_vp))

for i in range(index_first, index_last):
    # Log the progress we are making!
    if (not opened_only_once):
        logfile = open(datadir + logname, 'a')
    else:
        opened_only_once = False
    logfile.write('adding %s/Meridional_Slices/%s to the distribution...\n'\
                  %(dirname.split('/')[-1],file_list[i]))
    logfile.close()   
    # Print the message for good measure
    print('adding %s/Meridional_Slices/%s to the distribution...\n'\
          %(dirname.split('/')[-1],file_list[i]))
    
    mer = Meridional_Slice(radatadir + file_list[i], '')
    niter = mer.niter
    nphi = mer.nphi

    # Loop through each phi-value the Meridional_Slice and each
    # time in it.
    for pindex in range(nphi):
        for tindex in range(mer.niter):
            # Compute the vr and vp values for this phi-value and time
            # convert data from (cm/s) --> (m/s)
            vr_mer = mer.vals[pindex,:,:,mer.lut[1],tindex]/100.
            vp_mer = mer.vals[pindex,:,:,mer.lut[3],tindex]/100.

            # Loop through the current slice in theta-r space,
            # binning each value of vr and s accordingly.
            
Ejemplo n.º 3
0
#    self.time[0:niter-1]                          : The simulation time corresponding to each time step
#    self.version                                  : The version code for this particular output (internal use)
#    self.lut                                      : Lookup table for the different diagnostics output
#    """

from diagnostic_reading import Meridional_Slice
import numpy as np
import matplotlib.pyplot as plt

timestep = '00005000'
quantity_code = 64  # read in temperature
remove_mean = True  # remove the ell=0 mean
tindex = 0  # Display the first timestep from the file
pindex = 4  # Display the 5th phi-value output

a = Meridional_Slice(timestep)

#Set up the grid
nr = a.nr
ntheta = a.ntheta
r = a.radius / np.max(a.radius)
# We apply a shift in theta so that theta=0 corresponds to equator and the poles appear where we expect them to...
theta = np.arccos(a.costheta) - np.pi / 2

radius_matrix, theta_matrix = np.meshgrid(r, theta)

X = radius_matrix * np.cos(theta_matrix)
Y = radius_matrix * np.sin(theta_matrix)

qindex = a.lut[quantity_code]
field = np.zeros((ntheta, nr), dtype='float64')