Exemplo n.º 1
0
	def cr_envi_static(self, in_dir, f, out_dir, waves):
		
		self.writeMessage("cr_envi_dynamic")
		
		wt = self.wave_thresh
		static_ranges = self.get_static_ranges()
		
		base = f[:f.rfind(".")]
		
		for static_range in static_ranges:
			
			wl_low = static_range[0]
			wl_high = static_range[1]
			
			if (wl_high - wl_low < wt) or (wl_high >= waves[len(waves)-1]) or (wl_low  <= waves[0]):
				self.writeMessage("Error. Band wavelength range.")
				return
				
			r_out_dir = "%s/%f-%f" % (out_dir, wl_low, wl_high)
			
			if not os.path.exists(r_out_dir):
				os.makedirs(r_out_dir)
			
			in_hdr_path = in_dir + "/" + f + ".hdr" 
			in_dat_path = in_dir + "/" + f + ".dat"
			out_hdr_path = r_out_dir + "/" + f + ".hdr"
			out_dat_path = r_out_dir + "/" + f + ".dat"
			
			(f_width, low_i, high_i) =\
			self.compute_cr_band_extents(waves, wl_low, wl_high)
			
			self.generate_cr_header(in_hdr_path, out_hdr_path, waves, f_width, low_i, high_i)
			
			CR_module.cr_envi(in_hdr_path, in_dat_path, out_dat_path, wl_low, wl_high)
		
		self.writeMessage("Done!")