示例#1
0
dat = nc.Dataset(toponame)
x   = dat.variables['lon'][:]
y   = dat.variables['lat'][:]
h   = dat.variables['topo'][:]

hraw = h.copy()

#########################################################################
## COMPUTING THE MASK
#########################################################################
print ' \n' + '==> ' + '  COMPUTING THE MASK ...\n' + ' '

maskr = np.zeros(h.shape)
maskr[ np.where(h > 0) ] = 1 
maskr = process_mask(maskr)
[masku, maskv, maskp] = uvp_mask(maskr) 

# Cut the topography
h[ np.where(h < roms.hmin) ] = roms.hmin

# computing rx1 factor based on N, Ts, Tb, Hc choices: should be 3 < rx1 < 7
sc = ( np.arange(1, roms.N + 1) - roms.N - 0.5 ) / roms.N
sigma = stretching(sc, roms.Vstret, roms.theta_s, roms.theta_b)
zlev = get_zlev(h, sigma, roms.hc, sc, Vtransform=roms.Vtrans)
rx1 = rl.rx1(zlev, maskr)

if rx1.max() < 3 or rx1.max() > 7:
    print "\n\n\n WARNING: rx1 = %s values violates thresholds !" %rx1.max()
    m = Basemap(resolution='i', llcrnrlon=Lonr.min(), urcrnrlon=Lonr.max(),
                                llcrnrlat=Latr.min(), urcrnrlat=Latr.max())
    m.pcolormesh(Lonr, Latr, rx1, vmin=3, vmax=7)
示例#2
0
            break
        line, col = romslab.near2d(grd.mlonr, grd.mlatr, p[0][0], p[0][1])
        grd.maskr[line, col] = 1
        plt.fill( (grd.mlonr[line,col], grd.mlonr[line+1,col], grd.mlonr[line+1,col+1],
                grd.mlonr[line,col+1], grd.mlonr[line,col] ),
                (grd.mlatr[line,col], grd.mlatr[line+1,col], grd.mlatr[line+1,col+1], 
                grd.mlatr[line,col+1], grd.mlatr[line,col] ), 'w' )
        tellme('Keep unmasking! Just click the scroll buttom when you are done.')
        
    tellme('Do you wish to unmask another area? Go to the prompt. ')
    c = raw_input('Do you wish to unmask another area? [y/n] ')



### Creating masku and maskv based on maskr
[grd.masku, grd.maskv, grd.maskp] = romslab.uvp_mask(grd.maskr)

### Writing changes to netcdf file
grd.ncfile.variables['mask_rho'][:] = grd.maskr
grd.ncfile.variables['mask_u'][:] = grd.masku
grd.ncfile.variables['mask_v'][:] = grd.maskv
grd.ncfile.variables['mask_psi'][:] = grd.maskp

grd.ncfile.sync()






示例#3
0
        'Time to unmask now. Please click the land cell you wish to unmask:')

    while p != []:
        p = plt.ginput(n=1, timeout=0)
        if p == []:
            break
        line, col = romslab.near2d(grd.mlonr, grd.mlatr, p[0][0], p[0][1])
        grd.maskr[line, col] = 1
        plt.fill((grd.mlonr[line, col], grd.mlonr[line + 1, col],
                  grd.mlonr[line + 1, col + 1], grd.mlonr[line, col + 1],
                  grd.mlonr[line, col]),
                 (grd.mlatr[line, col], grd.mlatr[line + 1, col],
                  grd.mlatr[line + 1, col + 1], grd.mlatr[line, col + 1],
                  grd.mlatr[line, col]), 'w')
        tellme(
            'Keep unmasking! Just click the scroll buttom when you are done.')

    tellme('Do you wish to unmask another area? Go to the prompt. ')
    c = raw_input('Do you wish to unmask another area? [y/n] ')

### Creating masku and maskv based on maskr
[grd.masku, grd.maskv, grd.maskp] = romslab.uvp_mask(grd.maskr)

### Writing changes to netcdf file
grd.ncfile.variables['mask_rho'][:] = grd.maskr
grd.ncfile.variables['mask_u'][:] = grd.masku
grd.ncfile.variables['mask_v'][:] = grd.maskv
grd.ncfile.variables['mask_psi'][:] = grd.maskp

grd.ncfile.sync()