# Changeset 0e2f93e in flex_extract.git

Ignore:
Timestamp:
Nov 27, 2018, 9:41:47 PM (6 months ago)
Branches:
dev
Children:
786cfd6
Parents:
ca48036
Message:

applied some pep8 styles

File:
1 edited

Unmodified
Removed
• ## source/python/mods/disaggregation.py

 r708c667 # time step dt=1.0 dt = 1.0 ############### Non-negative Geometric Mean Based Algorithm ############### # the value at t=0 of the interpolation algorithm coincides with the # first data value according to the persistence hypothesis f=[g[0]] f = [g[0]] # compute two first sub-grid intervals without monotonicity check # points and interpolate the corresponding data values # except for the last interval due to boundary conditions for i in range(0,2): for i in range(0, 2): # as a requirement: # interval in f has to be zero to such that f[i+1]=f[i+2]=f[i+3]=0 # according to Eq. (6) if g[i]==0.: f.extend([0.,0.,0.]) if g[i] == 0.: f.extend([0., 0., 0.]) # otherwise the sub-grid values are calculated and added to the list # the function value at the first sub-grid point (fi1) is determined # according to the equal area condition with Eq. (19) fi1=3./2.*g[i]-5./12.*fip1-1./12.*fi fi1 = 3./2.*g[i]-5./12.*fip1-1./12.*fi # the function value at the second sub-grid point (fi2) is determined # according Eq. (18) fi2=fi1+1./3.*(fip1-fi) fi2 = fi1+1./3.*(fip1-fi) # add next interval of interpolated (sub-)grid values # points and interpolate the corresponding data values # except for the last interval due to boundary conditions for i in range(2,len(g)-1): for i in range(2, len(g)-1): # as a requirement: # interval in f has to be zero to such that f[i+1]=f[i+2]=f[i+3]=0 # according to Eq. (6) if g[i]==0.: if g[i] == 0.: # apply monotonicity filter for interval before # check if there is "M" or "W" shape if     np.sign(f[-5]-f[-6]) * np.sign(f[-4]-f[-5])==-1 \ and np.sign(f[-4]-f[-5]) * np.sign(f[-3]-f[-4])==-1 \ and np.sign(f[-3]-f[-4]) * np.sign(f[-2]-f[-3])==-1: if     np.sign(f[-5]-f[-6]) * np.sign(f[-4]-f[-5]) == -1 \ and np.sign(f[-4]-f[-5]) * np.sign(f[-3]-f[-4]) == -1 \ and np.sign(f[-3]-f[-4]) * np.sign(f[-2]-f[-3]) == -1: # the monotonicity filter corrects the value at (fim1) by # interval boundaries (fi) and (fip2) remains unchanged # see Eq. (18) and (19) f[-4]=fmon f[-6]=3./2.*g[i-2]-5./12.*fmon-1./12.*f[-7] f[-5]=f[-6]+(fmon-f[-7])/3. f[-3]=3./2.*g[i-1]-5./12.*f[-1]-1./12.*fmon f[-2]=f[-3]+(f[-1]-fmon)/3. f[-4] = fmon f[-6] = 3./2.*g[i-2]-5./12.*fmon-1./12.*f[-7] f[-5] = f[-6]+(fmon-f[-7])/3. f[-3] = 3./2.*g[i-1]-5./12.*f[-1]-1./12.*fmon f[-2] = f[-3]+(f[-1]-fmon)/3. f.extend([0.,0.,0.]) # geometric mean, restricted such that non-negativity is guaranteed # according to Eq. (25) fip1=min( 3.*g[i] , 3.*g[i+1] , np.sqrt(g[i+1]*g[i]) ) fip1 = min( 3.*g[i] , 3.*g[i+1] , np.sqrt(g[i+1]*g[i]) ) # the function value at the first sub-grid point (fi1) is determined # according to the equal area condition with Eq. (19) fi1=3./2.*g[i]-5./12.*fip1-1./12.*fi fi1 = 3./2.*g[i]-5./12.*fip1-1./12.*fi # the function value at the second sub-grid point (fi2) is determined # according Eq. (18) fi2=fi1+1./3.*(fip1-fi) fi2 = fi1+1./3.*(fip1-fi) # apply monotonicity filter for interval before # check if there is "M" or "W" shape if     np.sign(f[-5]-f[-6]) * np.sign(f[-4]-f[-5])==-1 \ and np.sign(f[-4]-f[-5]) * np.sign(f[-3]-f[-4])==-1 \ and np.sign(f[-3]-f[-4]) * np.sign(f[-2]-f[-3])==-1: if     np.sign(f[-5]-f[-6]) * np.sign(f[-4]-f[-5]) == -1 \ and np.sign(f[-4]-f[-5]) * np.sign(f[-3]-f[-4]) == -1 \ and np.sign(f[-3]-f[-4]) * np.sign(f[-2]-f[-3]) == -1: # the monotonicity filter corrects the value at (fim1) by # interval boundaries (fi) and (fip2) remains unchanged # see Eq. (18) and (19) f[-4]=fmon f[-6]=3./2.*g[i-2]-5./12.*fmon-1./12.*f[-7] f[-5]=f[-6]+(fmon-f[-7])/3. f[-3]=3./2.*g[i-1]-5./12.*f[-1]-1./12.*fmon f[-2]=f[-3]+(f[-1]-fmon)/3. f[-4] = fmon f[-6] = 3./2.*g[i-2]-5./12.*fmon-1./12.*f[-7] f[-5] = f[-6]+(fmon-f[-7])/3. f[-3] = 3./2.*g[i-1]-5./12.*f[-1]-1./12.*fmon f[-2] = f[-3]+(f[-1]-fmon)/3. # add next interval of interpolated (sub-)grid values # interval in f has to be zero to such that f[i+1]=f[i+2]=f[i+3]=0 # according to Eq. (6) if g[-1]==0.: if g[-1] == 0.: # apply monotonicity filter for interval before # check if there is "M" or "W" shape if     np.sign(f[-5]-f[-6]) * np.sign(f[-4]-f[-5])==-1 \ and np.sign(f[-4]-f[-5]) * np.sign(f[-3]-f[-4])==-1 \ and np.sign(f[-3]-f[-4]) * np.sign(f[-2]-f[-3])==-1: if     np.sign(f[-5]-f[-6]) * np.sign(f[-4]-f[-5]) == -1 \ and np.sign(f[-4]-f[-5]) * np.sign(f[-3]-f[-4]) == -1 \ and np.sign(f[-3]-f[-4]) * np.sign(f[-2]-f[-3]) == -1: # the monotonicity filter corrects the value at (fim1) by # interval boundaries (fi) and (fip2) remains unchanged # see Eq. (18) and (19) f[-4]=fmon f[-6]=3./2.*g[-3]-5./12.*fmon-1./12.*f[-7] f[-5]=f[-6]+(fmon-f[-7])/3. f[-3]=3./2.*g[-2]-5./12.*f[-1]-1./12.*fmon f[-2]=f[-3]+(f[-1]-fmon)/3. f[-4] = fmon f[-6] = 3./2.*g[-3]-5./12.*fmon-1./12.*f[-7] f[-5] = f[-6]+(fmon-f[-7])/3. f[-3] = 3./2.*g[-2]-5./12.*f[-1]-1./12.*fmon f[-2] = f[-3]+(f[-1]-fmon)/3. f.extend([0.,0.,0.]) # apply monotonicity filter for interval before # check if there is "M" or "W" shape if     np.sign(f[-5]-f[-6]) * np.sign(f[-4]-f[-5])==-1 \ and np.sign(f[-4]-f[-5]) * np.sign(f[-3]-f[-4])==-1 \ and np.sign(f[-3]-f[-4]) * np.sign(f[-2]-f[-3])==-1: if     np.sign(f[-5]-f[-6]) * np.sign(f[-4]-f[-5]) == -1 \ and np.sign(f[-4]-f[-5]) * np.sign(f[-3]-f[-4]) == -1 \ and np.sign(f[-3]-f[-4]) * np.sign(f[-2]-f[-3]) == -1: # the monotonicity filter corrects the value at (fim1) by # interval boundaries (fi) and (fip2) remains unchanged # see Eq. (18) and (19) f[-4]=fmon f[-6]=3./2.*g[-3]-5./12.*fmon-1./12.*f[-7] f[-5]=f[-6]+(fmon-f[-7])/3. f[-3]=3./2.*g[-2]-5./12.*f[-1]-1./12.*fmon f[-2]=f[-3]+(f[-1]-fmon)/3. f[-4] = fmon f[-6] = 3./2.*g[-3]-5./12.*fmon-1./12.*f[-7] f[-5] = f[-6]+(fmon-f[-7])/3. f[-3] = 3./2.*g[-2]-5./12.*f[-1]-1./12.*fmon f[-2] = f[-3]+(f[-1]-fmon)/3. # add next interval of interpolated (sub-)grid values
Note: See TracChangeset for help on using the changeset viewer.