Class: CMORizer::Step::AUTO_DOWNSAMPLE_FREQUENCY
- Defined in:
- lib/step.rb
Instance Attribute Summary
Attributes inherited from BaseStep
#forbid_inplace, #initial_prefix, #needs_to_run, #resultpath
Instance Method Summary collapse
Methods inherited from BaseStep
#add_input, #create_outpath, #initialize, #set_info, #truncate_string
Constructor Details
This class inherits a constructor from CMORizer::Step::BaseStep
Instance Method Details
#can_process?(number_of_eventual_input_years) ⇒ Boolean
152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/step.rb', line 152 def can_process?(number_of_eventual_input_years) in_freq = Frequency.for_name(@fesom_variable_frequency) out_freq = Frequency.for_name(@global_attributes.frequency) if out_freq.name == "dec" && in_freq < out_freq raise OutputFrequencyExceedsInputRangeError.new "#{self.class} can not produce decadal output from #{number_of_eventual_input_years} input years (must have 10 years)" if number_of_eventual_input_years != 10 return number_of_eventual_input_years == 10 else return true end end |
#file_commands ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/step.rb', line 165 def file_commands cmds = [] in_freq = Frequency.for_name(@fesom_variable_frequency) out_freq = Frequency.for_name(@global_attributes.frequency) if(in_freq != out_freq) case [in_freq.name, out_freq.name] when ["day", "mon"] # cdo monmean day_file mon_file cmds << CDO_MONMEAN_cmd.new when ["mon", "yr"] cmds << CDO_YEARMEAN_cmd.new when ["day", "dec"], ["mon", "dec"] cmds << CDO_TIMMEAN_cmd.new # this will just create a single mean output, so make sure we put in a 10 years file else raise "can not automatically downsample frequency from '#{in_freq.name}' to '#{out_freq.name}'" end end cmds end |