Esempio n. 1
0
        #if 1: # debug
        #plt.pcolormesh(ecco.lon(), ecco.lat(), ecco.maskr())
        #plt.scatter(ecco.lon().flat[ecco.ball], ecco.lat().flat[ecco.ball],
        #s=10,c='g',edgecolors='none')
        #plt.plot(romsgrd.boundary()[0], romsgrd.boundary()[1], 'w')
        #plt.axis('image')
        #plt.show()

        # Read in variables and interpolate to romsgrd
        ecco.get_variable(ini_date_num).fillmask()
        ecco.interp2romsgrd()

        if '3D' in ecco.dimtype:

            for j in np.arange(romsgrd.maskr().shape[0]):

                if j / 100. == np.fix(j / 100.):
                    print '------ j = %s of %s' % (j + 1,
                                                   romsgrd.maskr().shape[0])

                ecco.set_map_coordinate_weights(j=j)
                ecco.vert_interp(j=j)

        # Calculate barotropic velocities
        if ecco.vartype in ('U', 'V'):
            ecco.set_barotropic()

        # Write to initial file
        print 'Saving *%s* to %s' % (ecco.vartype, romsini.romsfile)
        with netcdf.Dataset(romsini.romsfile, 'a') as nc:
Esempio n. 2
0
    frc_file = directory + 'blk_nwmed_2km_2006-2006_6hr.nc'
    grd = RomsGrid(directory + 'grd_nwmed_2km.nc', sigma_params, 'ROMS')

    year_str = 2006
    year_end = 2006

    if 'blk' in frc_file:
        savefile = directory + 'cfsr_blk_monthly_%s-%s.nc' % (str(year_str),
                                                              str(year_end))
    else:
        savefile = directory + 'cfsr_frc_monthly_%s-%s.nc' % (str(year_str),
                                                              str(year_end))

    #--End user defined options-----------------------------------

    Mp, Np = grd.maskr().shape

    year_str = dt.datetime.datetime(year_str, 1, 1)
    year_end = dt.datetime.datetime(year_end, 12, 31)

    start_dic = io.loadmat(directory + 'start_date.mat')
    start_date = start_dic['start_date']

    create_file = True

    nc = netcdf.Dataset(frc_file)

    bulk_time = nc.variables['bulk_time'][:]

    #var = 'init'
    vars_rho = np.array(
Esempio n. 3
0
    grd = RomsGrid(directory + 'grd_nwmed_2km.nc', sigma_params, 'ROMS')
    
    year_str = 2006
    year_end = 2006
    
    if 'blk' in frc_file:
        savefile = directory + 'cfsr_blk_monthly_%s-%s.nc' %(str(year_str), str(year_end))
    else:
        savefile = directory + 'cfsr_frc_monthly_%s-%s.nc' %(str(year_str), str(year_end))
    
    


    #--End user defined options-----------------------------------

    Mp, Np = grd.maskr().shape

    year_str = dt.datetime.datetime(year_str, 1, 1)
    year_end = dt.datetime.datetime(year_end, 12, 31)
    
    
    
    start_dic = io.loadmat(directory + 'start_date.mat')
    start_date = start_dic['start_date']

    create_file = True


    
    nc = netcdf.Dataset(frc_file)
    
Esempio n. 4
0
 
     #if 1: # debug
         #plt.pcolormesh(ecco.lon(), ecco.lat(), ecco.maskr())
         #plt.scatter(ecco.lon().flat[ecco.ball], ecco.lat().flat[ecco.ball],
                     #s=10,c='g',edgecolors='none')
         #plt.plot(romsgrd.boundary()[0], romsgrd.boundary()[1], 'w')
         #plt.axis('image')
         #plt.show()
     
     # Read in variables and interpolate to romsgrd
     ecco.get_variable(ini_date_num).fillmask()
     ecco.interp2romsgrd()
     
     if '3D' in ecco.dimtype:
         
         for j in np.arange(romsgrd.maskr().shape[0]):
         
             if j / 100. == np.fix(j / 100.):
                 print '------ j = %s of %s' %(j+1, romsgrd.maskr().shape[0])
             
             ecco.set_map_coordinate_weights(j=j)
             ecco.vert_interp(j=j)
     
     # Calculate barotropic velocities
     if ecco.vartype in ('U', 'V'):
         ecco.set_barotropic()
     
     # Write to initial file
     print 'Saving *%s* to %s' %(ecco.vartype, romsini.romsfile)
     with netcdf.Dataset(romsini.romsfile, 'a') as nc: