本文整理汇总了Python中netCDF4.Dataset.data_variable_name方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.data_variable_name方法的具体用法?Python Dataset.data_variable_name怎么用?Python Dataset.data_variable_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类netCDF4.Dataset
的用法示例。
在下文中一共展示了Dataset.data_variable_name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setNetCDFDataVariableNameAttribute
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import data_variable_name [as 别名]
def setNetCDFDataVariableNameAttribute(netCDF_File, variableName):
# open the file with read/write mode (r+)
rootGrp = Dataset(netCDF_File, 'r+', format='NETCDF3_CLASSIC')
rootGrp.data_variable_name = variableName
#close the file
rootGrp.close()
示例2: Dataset
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import data_variable_name [as 别名]
#open a new blank netcdf file to which we will be writting data
outRootGrp = Dataset(outNetCDF_File, 'w', format='NETCDF3_CLASSIC')
if (inRootGrp.start_year != startDate.year):
raise Exception("Specified simulation start year ({0}) does not match with input vapor pressure data file data year.".format(startDate.year))
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])
开发者ID:CI-Water-DASYCIM,项目名称:UEBPythonPackage,代码行数:32,代码来源:GenerateWatershedDaymetMultipleVpdDataPointsPerDay.py
示例3: Dataset
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import data_variable_name [as 别名]
inRootGrp = Dataset(inNetCDF_File, 'r', format='NETCDF3_CLASSIC')
# open a new blank netcdf file to which we will be writting data
outRootGrp = Dataset(outNetCDF_File, 'w', format='NETCDF3_CLASSIC')
if (inRootGrp.start_year != startDate.year):
raise Exception("Specified simulation start year ({0}) does not match with input precp data file data year.".format(startDate.year))
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 = 'Prec'
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']
inputPrecVar = inRootGrp.variables['Prec']
print(inputTimeVar.shape[0])
print(inputXvar.shape[0])
开发者ID:CI-Water-DASYCIM,项目名称:UEBPythonPackage,代码行数:33,代码来源:GenerateWatershedDaymetMultiplePrecpDataPointsPerDay.py
示例4: print
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import data_variable_name [as 别名]
inputTaYVar = inRootGrpTa.variables['y']
inputTaTimeVar = inRootGrpTa.variables['time']
inputVpVar = inRootGrpVp.variables[inRootGrpVp.data_variable_name]
inputVpTimeVar = inRootGrpVp.variables['time']
#DEBUG: print netcdf variable diemensions
print('Dimension of Temp var: ' + str(inputTaVar.shape))
print('Dimension of Vp var: ' + str(inputVpVar.shape))
#open a new blank netcdf file to which we will be writting data
outRootGrp = Dataset(outRH_NetCDFFile, 'w', format='NETCDF3_CLASSIC')
# add global file level attributes to the new netcdf file
outRootGrp.start_year = inRootGrpTa.start_year
outRootGrp.data_variable_name = outNetCDFDataVariableName
outRootGrp.data_time_step = inRootGrpTa.data_time_step
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'
# create 3 dimensions for the output netcdf file
outTimeDimensionSize = inputVpVar.shape[0]
outYvarDimensionSize = inputVpVar.shape[1]
outXvarDimensionSize = inputVpVar.shape[2]
outRootGrp.createDimension('time', outTimeDimensionSize)
outRootGrp.createDimension('x', outXvarDimensionSize)
outRootGrp.createDimension('y', outYvarDimensionSize)
开发者ID:CI-Water-DASYCIM,项目名称:UEBPythonPackage,代码行数:33,代码来源:GenerateWatershedDaymetMultipleRHDataPerDay.py
示例5: Dataset
# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import data_variable_name [as 别名]
inputTminVar = inRootGrpTmin.variables['tmin']
inputTmaxVar = inRootGrpTmax.variables['tmax']
inputXminVar = inRootGrpTmin.variables['x']
inputYminVar = inRootGrpTmin.variables['y']
# open a new blank netcdf file to which we will be writting data
# TODO: date:11/12/2013 change the format for writting to netcdf to
# NETCDF4_CLASSIC in order to be able to create a nc file size greater
# than 2 GB
# Ref: http://www.ncl.ucar.edu/Support/talk_archives/2011/0599.html
outNetCDF_File = os.path.join(outNetCDFFilePath, outNetCDF_FileName)
outRootGrp = Dataset(outNetCDF_File, 'w', format='NETCDF3_CLASSIC')
# add global file level attributes to the new netcdf file
outRootGrp.start_year = inRootGrpTmin.start_year
outRootGrp.data_variable_name = outDataVariableName
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'
print(inputTminVar.shape)
# Create 3 dimensions for the 3 variables: time, x and y
dataPointsPerDayNeeded = 24/inTimeStep
outTimeDimensionSize = inputTminVar.shape[0] * dataPointsPerDayNeeded
outYvarDimensionSize = inputTminVar.shape[1]
outXvarDimensionSize = inputTminVar.shape[2]
outRootGrp.createDimension('time', outTimeDimensionSize)
开发者ID:CI-Water-DASYCIM,项目名称:UEBPythonPackage,代码行数:33,代码来源:GenerateWatershedDaymetMultipleTempDataPerDay.py