Exemplo n.º 1
0
    output_file = output_dir + "regridded_" + input_file
    
    ## Find new drive_file entry
    if date not in drive_date: 
        drive_date.append(date)
        fname = '%vv/%vv'.join(output_file.split(cube.var_name))
        fnames.append(fname) 


    ## Regrid and output climate
    output_data = cube.regrid( mask, iris.analysis.Nearest())
    
    if not path.isdir(output_dir): mkdir(output_dir)
    iris.save(output_data, output_file)
    
    output = Dataset(output_file, 'r+', format='NETCDF4')
    output.regridding = info
    output.close()

## Output drive_file
drive_date = sorted(drive_date)
fnames     = sorted(fnames)

drive_info = '\n'.join("'" + getcwd() + '/' + a + "', '" + b + "'" for a,b in zip(fnames, drive_date))
drive_file = open("outputs/drive_file.txt", "w")

drive_file.write(drive_info)
drive_file.close()