def setup_out_file(self): ''' Setup for the out_file, which outputs both the .json and .txt. ''' self.out_file.set_target_grid( self.parameter.target_grid, self.regrid_tool, self.regrid_method) self.out_file.variable = self.var self.out_file.realm = self.realm self.out_file.table = self.table_realm self.out_file.case_id = self.parameter.case_id DataSet.apply_custom_keys(self.out_file, self.parameter.custom_keys, self.var)
def setup_out_file(self): ''' Setup for the out_file, which outputs both the .json and .txt. ''' self.out_file.set_target_grid(self.parameter.target_grid, self.regrid_tool, self.regrid_method) self.out_file.variable = self.var self.out_file.realm = self.realm self.out_file.table = self.table_realm self.out_file.case_id = self.parameter.case_id DataSet.apply_custom_keys(self.out_file, self.parameter.custom_keys, self.var)
def setup_out_file(self): ''' Setup for the out_file, which outputs both the .json and .txt. ''' self.out_file.set_target_grid( self.parameter.target_grid, self.regrid_tool, self.regrid_method) self.out_file.variable = self.var self.out_file.realm = self.realm self.out_file.table = self.table_realm self.out_file.case_id = self.parameter.case_id if hasattr(self, "obs_or_model"): self.out_file.model_version = self.obs_or_model for key in self.out_file.keys(): if hasattr(self.parameter, key): setattr(self.out_file, key, getattr(self.parameter, key)) if hasattr(self, key): setattr(self.out_file, key, getattr(self, key)) DataSet.apply_custom_keys(self.out_file, self.parameter.custom_keys, self.var)
def output_interpolated_model_climatologies(self, test, test_data): ''' Save the netCDF file. ''' region_name = self.get_region_name_from_region(test.region) pth = os.path.join(self.parameter.test_clims_interpolated_output, region_name) clim_file = Base(pth, self.parameter.filename_output_template) logging.info('Saving interpolated climatologies to: %s' % clim_file()) clim_file.level = self.out_file.level clim_file.model_version = test.obs_or_model clim_file.table = self.table_realm clim_file.period = self.parameter.period clim_file.case_id = self.parameter.case_id clim_file.set_target_grid(self.parameter.target_grid, self.regrid_tool, self.regrid_method) clim_file.variable = self.var clim_file.region = region_name clim_file.realization = self.parameter.realization DataSet.apply_custom_keys(clim_file, self.parameter.custom_keys, self.var) clim_file.write(test_data, type="nc", id=self.var)
def output_interpolated_model_climatologies(self, test, test_data): ''' Save the netCDF file. ''' region_name = self.get_region_name_from_region(test.region) pth = os.path.join(self.parameter.test_clims_interpolated_output, region_name) clim_file = Base(pth, self.parameter.filename_output_template) logging.getLogger("pcmdi_metrics").info('Saving interpolated climatologies to: %s' % clim_file()) clim_file.level = self.out_file.level clim_file.model_version = test.obs_or_model clim_file.table = self.table_realm clim_file.period = self.parameter.period clim_file.case_id = self.parameter.case_id clim_file.set_target_grid( self.parameter.target_grid, self.regrid_tool, self.regrid_method) clim_file.variable = self.var clim_file.region = region_name clim_file.realization = self.parameter.realization DataSet.apply_custom_keys(clim_file, self.parameter.custom_keys, self.var) clim_file.write(test_data, type="nc", id=self.var)