Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- import inspect
- import os
- import sys
- import glob
- from nansat import Nansat, Domain
- def process(ffile):
- print ffile.split('/')[-1]
- n = Nansat(ffile)
- #print n
- #repojection
- srsString = "+proj=stere +lon_0=0 +lat_0=90 +k=1 +ellps=WGS84 +datum=WGS84 +no_defs"
- extentString = "-lle 95.0 65.0 110.0 90.0 -tr 100 100"
- n.reproject_GCPs(srsString)
- dStereo = Domain(srsString, extentString)
- n.reproject(dStereo, 2)
- # land mask
- wm = n.watermask()
- wmArray = wm[1]
- out_f = 'reprojected/ps_' + ffile.split('/')[-1] + '.tif'
- # save a figure
- # n.write_figure(out_f, transparentMask=True, mask_array=wmArray, mask_lut={0: [0,0,0]}, bands=[3], cmapName='gray', transparency=[0,0,0])
- n.write_figure(out_f, bands=3, mask_array=wmArray, mask_lut={0: [0,0,0]}, clim=[0,0.7], logarithm=True, gamma=2, cmapName='gray')
- files_path = sys.argv[1]
- ffiles = glob.glob(files_path)
- for ffile in ffiles:
- #print "\nStart processing %s ..." % ffile
- try:
- process(ffile)
- except:
- print "Error!"
Advertisement
Add Comment
Please, Sign In to add comment