Module: CodeRunner::Gs2::ReadNetcdf

Included in:
CodeRunner::Gs2
Defined in:
lib/gs2crmod/read_netcdf.rb

Instance Method Summary collapse

Instance Method Details

#new_nccloseObject



31
32
33
34
# File 'lib/gs2crmod/read_netcdf.rb', line 31

def new_ncclose
	cache[:new_netcdf_file].close
	cache.delete(:new_netcdf_file)
end

#new_netcdf_fileObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gs2crmod/read_netcdf.rb', line 13

def new_netcdf_file
	if (open = @runner.run_list.keys.find_all{|id|  @runner.run_list[id].cache[:new_netcdf_file]}).size > 200
		open = open.sort_by{|id| @runner.run_list[id].cache[:new_netcdf_file_otime]}
		@runner.run_list[open[0]].new_ncclose
	end

	if cache[:new_netcdf_file] and not [:Complete, :Failed].include? @status
		new_ncclose
	end
	cache[:new_netcdf_file_otime] = Time.now.to_i
	cache[:new_netcdf_file] ||= NumRu::NetCDF.open(new_netcdf_filename)
	cache[:new_netcdf_file].sync
	cache[:new_netcdf_file]
end

#new_netcdf_filenameObject



28
29
30
# File 'lib/gs2crmod/read_netcdf.rb', line 28

def new_netcdf_filename
	@directory + '/' +  @run_name + '.cdf'
end