Exemplo n.º 1
0
file = '/archive/u1/uaf/kate/SODA/1985/SODA_2.1.6_19841230-19850104.cdf'
dst_dir='./'

print 'Build IC file from the following file:'
print file
print ' '

src_grd = pyroms_toolbox.BGrid_SODA.get_nc_BGrid_SODA('/archive/u1/uaf/kate/SODA/SODA_grid.cdf', name='SODA_2.1.6_ARC', area='global')
dst_grd = pyroms.grid.get_ROMS_grid('ARCTIC')

# remap
zeta = remap(file, 'ssh', src_grd, dst_grd, dst_dir=dst_dir)
dst_grd = pyroms.grid.get_ROMS_grid('ARCTIC', zeta=zeta)
remap(file, 'temp', src_grd, dst_grd, dst_dir=dst_dir)
remap(file, 'salt', src_grd, dst_grd, dst_dir=dst_dir)
remap_uv(file, src_grd, dst_grd, dst_dir=dst_dir)

# merge file
ic_file = dst_dir + file.rsplit('/')[-1][:-4] + '_ic_' + dst_grd.name + '.nc'

out_file = dst_dir + file.rsplit('/')[-1][:-4] + '_ssh_ic_' + dst_grd.name + '.nc'
command = ('ncks', '-a', '-O', out_file, ic_file)
#subprocess.check_call(command)
subprocess.call(command)
os.remove(out_file)
out_file = dst_dir + file.rsplit('/')[-1][:-4] + '_temp_ic_' + dst_grd.name + '.nc'
command = ('ncks', '-a', '-A', out_file, ic_file)
#subprocess.check_call(command)
subprocess.call(command)
os.remove(out_file)
out_file = dst_dir + file.rsplit('/')[-1][:-4] + '_salt_ic_' + dst_grd.name + '.nc'
Exemplo n.º 2
0
print file
print ' '

src_grd = pyroms_toolbox.BGrid_SODA.get_nc_BGrid_SODA(
    '/nfs/P1/Data/SODA/SODA_2.1.6/SODA_grid.cdf',
    name='SODA_2.1.6',
    area='npolar',
    ystart=240)
dst_grd = pyroms.grid.get_ROMS_grid('ARCTIC2')

# remap
zeta = remap(file, 'ssh', src_grd, dst_grd, dst_dir=dst_dir)
dst_grd = pyroms.grid.get_ROMS_grid('ARCTIC2', zeta=zeta)
remap(file, 'temp', src_grd, dst_grd, dst_dir=dst_dir)
remap(file, 'salt', src_grd, dst_grd, dst_dir=dst_dir)
remap_uv(file, src_grd, dst_grd, dst_dir=dst_dir)

# merge file
ic_file = dst_dir + file.rsplit('/')[-1][:-4] + '_ic_' + dst_grd.name + '.nc'

out_file = dst_dir + file.rsplit(
    '/')[-1][:-4] + '_ssh_ic_' + dst_grd.name + '.nc'
command = ('ncks', '-a', '-O', out_file, ic_file)
#subprocess.check_call(command)
subprocess.call(command)
os.remove(out_file)
out_file = dst_dir + file.rsplit(
    '/')[-1][:-4] + '_temp_ic_' + dst_grd.name + '.nc'
command = ('ncks', '-a', '-A', out_file, ic_file)
#subprocess.check_call(command)
subprocess.call(command)
Exemplo n.º 3
0
              interp_file1, interp_file2, map1_name, \
              map2_name, num_maps, map_method)

# load the grid
src_grd = get_nc_Grid_HYCOM(src_grd_file)
dst_grd = pyroms.grid.get_ROMS_grid(grid_name)

# Triggering of variables remapping

zero=731;l_time=732			#2006-01-01 - 731; 2009-01-01 - 1827

zeta = remap(zero,l_time, file, 'ssh', src_grd, dst_grd, grid_name)

remap(zero,l_time, file, 'votemper', src_grd, dst_grd, grid_name)
remap(zero,l_time, file, 'vosaline', src_grd, dst_grd, grid_name)
remap_uv(zero,l_time, file,  src_grd, dst_grd, grid_name)

# merge file
ic_file = '/home/eivanov/coawst_data_prrocessing/Temporal/Input_files_to_ROMS/ChildRiver_Initial.nc'
try:
	os.remove(ic_file)
except:
	pass

out_file = 'ssh%s.nc' %(grid_name)
command = ('ncks', '-a', '-A', out_file, ic_file) 
subprocess.check_call(command)
os.remove(out_file)

out_file = 'votemper%s.nc'  %(grid_name)
command = ('ncks', '-a', '-A', out_file, ic_file) 
Exemplo n.º 4
0
zeta_dst_file = dst_dir + dst_grd.name + '_ic_zeta_' + tag + '_' + src_grd.name + '.nc'
temp_dst_file = dst_dir + dst_grd.name + '_ic_temp_' + tag + '_' + src_grd.name + '.nc'
salt_dst_file = dst_dir + dst_grd.name + '_ic_salt_' + tag + '_' + src_grd.name + '.nc'
u_dst_file    = dst_dir + dst_grd.name + '_ic_u_'    + tag + '_' + src_grd.name + '.nc'
v_dst_file    = dst_dir + dst_grd.name + '_ic_v_'    + tag + '_' + src_grd.name + '.nc'

# remap ssh
zeta = remap('ssh', filein, src_grd, dst_grd, zeta_dst_file, dst_dir=dst_dir)

# reload grid with zeta (more accurate)
dst_grd = pyroms.grid.get_ROMS_grid('CCS', zeta=zeta)

# regrid temp, salt and velocities
remap('temp',filein, src_grd, dst_grd, temp_dst_file, dst_dir=dst_dir)
remap('salt',filein, src_grd, dst_grd, salt_dst_file, dst_dir=dst_dir)
remap_uv(filein, src_grd, dst_grd, u_dst_file, v_dst_file, dst_dir=dst_dir)

# merge file
ic_file = dst_dir + dst_grd.name + '_ic_' + tag + '_' + src_grd.name + '.nc'

command1 = 'mv '      + zeta_dst_file + ' '    + ic_file
command2 = 'ncks -A ' + temp_dst_file + ' -o ' + ic_file
command3 = 'ncks -A ' + salt_dst_file + ' -o ' + ic_file
command4 = 'ncks -A ' + u_dst_file    + ' -o ' + ic_file
command5 = 'ncks -A ' + v_dst_file    + ' -o ' + ic_file

subprocess.call(command1,shell=True)
subprocess.call(command2,shell=True)
subprocess.call(command3,shell=True)
subprocess.call(command4,shell=True)
subprocess.call(command5,shell=True)
Exemplo n.º 5
0
    # regrid temp, salt and velocities
    remap('temp',
          data_dir_year + filein,
          src_grd,
          dst_grd,
          temp_dst_file,
          dst_dir=dst_dir)
    remap('salt',
          data_dir_year + filein,
          src_grd,
          dst_grd,
          salt_dst_file,
          dst_dir=dst_dir)
    remap_uv(data_dir_year + filein,
             src_grd,
             dst_grd,
             u_dst_file,
             v_dst_file,
             dst_dir=dst_dir)

    # merge file
    clim_file = dst_dir + dst_grd.name + '_clim_' + tag + '_' + src_grd.name + '.nc'

    command1 = 'mv ' + zeta_dst_file + ' ' + clim_file
    command2 = 'ncks -A ' + temp_dst_file + ' -o ' + clim_file
    command3 = 'ncks -A ' + salt_dst_file + ' -o ' + clim_file
    command4 = 'ncks -A ' + u_dst_file + ' -o ' + clim_file
    command5 = 'ncks -A ' + v_dst_file + ' -o ' + clim_file

    subprocess.call(command1, shell=True)
    subprocess.call(command2, shell=True)
    subprocess.call(command3, shell=True)
Exemplo n.º 6
0
    zeta_dst_file = dst_dir + dst_grd.name + '_clim_zeta_' + tag + '_' + src_grd.name + '.nc'
    temp_dst_file = dst_dir + dst_grd.name + '_clim_temp_' + tag + '_' + src_grd.name + '.nc'
    salt_dst_file = dst_dir + dst_grd.name + '_clim_salt_' + tag + '_' + src_grd.name + '.nc'
    u_dst_file    = dst_dir + dst_grd.name + '_clim_u_'    + tag + '_' + src_grd.name + '.nc'
    v_dst_file    = dst_dir + dst_grd.name + '_clim_v_'    + tag + '_' + src_grd.name + '.nc'

    # remap ssh
    zeta = remap('ssh', data_dir_year + filein, src_grd, dst_grd, zeta_dst_file, dst_dir=dst_dir)

    # reload grid with zeta (more accurate)
    dst_grd = pyroms.grid.get_ROMS_grid('CCS', zeta=zeta)

    # regrid temp, salt and velocities
    remap('temp',data_dir_year + filein, src_grd, dst_grd, temp_dst_file, dst_dir=dst_dir)
    remap('salt',data_dir_year + filein, src_grd, dst_grd, salt_dst_file, dst_dir=dst_dir)
    remap_uv(data_dir_year + filein, src_grd, dst_grd, u_dst_file, v_dst_file, dst_dir=dst_dir)

    # merge file
    clim_file = dst_dir + dst_grd.name + '_clim_' + tag + '_' + src_grd.name + '.nc'

    command1 = 'mv '      + zeta_dst_file + ' '    + clim_file
    command2 = 'ncks -A ' + temp_dst_file + ' -o ' + clim_file
    command3 = 'ncks -A ' + salt_dst_file + ' -o ' + clim_file
    command4 = 'ncks -A ' + u_dst_file    + ' -o ' + clim_file
    command5 = 'ncks -A ' + v_dst_file    + ' -o ' + clim_file

    subprocess.call(command1,shell=True)
    subprocess.call(command2,shell=True)
    subprocess.call(command3,shell=True)
    subprocess.call(command4,shell=True)
    subprocess.call(command5,shell=True)