exit() # DEBUG: print global attributes of the original file: ## for gAttribute in inRootGrp.ncattrs(): ## print 'Global attribute name:', gAttribute, '=', getattr(inRootGrp,gAttribute) # add global file level attributes to the new netcdf file outRootGrp.start_year = inRootGrp.start_year outRootGrp.data_variable_name = inRootGrp.data_variable_name outRootGrp.data_time_step = inTimeStep outRootGrp.orginal_data_source = 'Daymet Software Version 2.0' outRootGrp.conventions = 'CF-1.0' outRootGrp.modified_data_source = 'CI Water System' outRootGrp.spatial_reference = 'NAD83_UTM_Zone_12N' outRootGrp.datum = 'D_North_America_1983' # get dimension values from the original netcdf file inputTimeVar = inRootGrp.variables['time'] inputXvar = inRootGrp.variables['x'] inputYvar = inRootGrp.variables['y'] inputVpVar = inRootGrp.variables[inRootGrp.data_variable_name] print(inputTimeVar.shape[0]) print(inputXvar.shape[0]) print(inputYvar.shape[0]) print(inputVpVar.shape) # create 3 dimensions for three variables: time, x and y dataPointsPerDayNeeded = 24/inTimeStep outTimeDimensionSize = inputTimeVar.shape[0] * dataPointsPerDayNeeded