当前位置: 首页>>代码示例>>Python>>正文


Python Dataset.link方法代码示例

本文整理汇总了Python中netCDF4.Dataset.link方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.link方法的具体用法?Python Dataset.link怎么用?Python Dataset.link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在netCDF4.Dataset的用法示例。


在下文中一共展示了Dataset.link方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createBryFile

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import link [as 别名]
def createBryFile(confM2R):
    if (confM2R.myformat == 'NETCDF4'):
        myzlib = True
    else:
        myzlib = False
    grdROMS = confM2R.grdROMS

    if os.path.exists(confM2R.bryname):
        os.remove(confM2R.bryname)
    print(('\n=>Creating initial Boundary (BRY) file {}'.format(confM2R.bryname)))

    f1 = Dataset(confM2R.bryname, mode='w', format=confM2R.myformat)
    f1.title = "Boundary forcing file (BRY) used for forcing of the ROMS model"
    f1.description = "Created for the {} grid file".format(confM2R.romsgridpath)
    f1.grdFile = "{}".format(confM2R.romsgridpath)
    f1.history = 'Created ' + time.ctime(time.time())
    f1.source = "{} ({})".format(confM2R.authorname, confM2R.authoremail)
    f1.type = "File in {} format created using MODEL2ROMS".format(confM2R.myformat)
    f1.link = "https://github.com/trondkr/model2roms"
    f1.Conventions = "CF-1.0"

    """ Define dimensions """
    f1.createDimension('xi_rho', grdROMS.xi_rho)
    f1.createDimension('eta_rho', grdROMS.eta_rho)
    f1.createDimension('xi_u', grdROMS.xi_u)
    f1.createDimension('eta_u', grdROMS.eta_u)
    f1.createDimension('xi_v', grdROMS.xi_v)
    f1.createDimension('eta_v', grdROMS.eta_v)
    f1.createDimension('xi_psi', grdROMS.xi_psi)
    f1.createDimension('eta_psi', grdROMS.eta_psi)
    f1.createDimension('ocean_time', None)
    f1.createDimension('s_rho', len(grdROMS.s_rho))
    f1.createDimension('s_w', len(grdROMS.s_w))

    vnc = f1.createVariable('lon_rho', 'd', ('eta_rho', 'xi_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
    vnc.long_name = 'Longitude of RHO-points'
    vnc.units = 'degree_east'
    vnc.standard_name = 'longitude'
    vnc[:, :] = grdROMS.lon_rho

    vnc = f1.createVariable('lat_rho', 'd', ('eta_rho', 'xi_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
    vnc.long_name = 'Latitude of RHO-points'
    vnc.units = 'degree_north'
    vnc.standard_name = 'latitude'
    vnc[:, :] = grdROMS.lat_rho

    vnc = f1.createVariable('lon_u', 'd', ('eta_u', 'xi_u',), zlib=myzlib, fill_value=grdROMS.fillval)
    vnc.long_name = 'Longitude of U-points'
    vnc.units = 'degree_east'
    vnc.standard_name = 'longitude'
    vnc[:, :] = grdROMS.lon_u

    vnc = f1.createVariable('lat_u', 'd', ('eta_u', 'xi_u',), zlib=myzlib, fill_value=grdROMS.fillval)
    vnc.long_name = 'Latitude of U-points'
    vnc.units = 'degree_north'
    vnc.standard_name = 'latitude'
    vnc[:, :] = grdROMS.lat_u

    vnc = f1.createVariable('lon_v', 'd', ('eta_v', 'xi_v',), zlib=myzlib, fill_value=grdROMS.fillval)
    vnc.long_name = 'Longitude of V-points'
    vnc.units = 'degree_east'
    vnc.standard_name = 'longitude'
    vnc[:, :] = grdROMS.lon_v

    vnc = f1.createVariable('lat_v', 'd', ('eta_v', 'xi_v',), zlib=myzlib, fill_value=grdROMS.fillval)
    vnc.long_name = 'Latitude of V-points'
    vnc.units = 'degree_north'
    vnc.standard_name = 'latitude'
    vnc[:, :] = grdROMS.lat_v

    vnc = f1.createVariable('lat_psi', 'd', ('eta_psi', 'xi_psi',), zlib=myzlib, fill_value=grdROMS.fillval)
    vnc.long_name = 'Latitude of PSI-points'
    vnc.units = 'degree_north'
    vnc.standard_name = 'latitude'
    vnc[:, :] = grdROMS.lat_psi

    vnc = f1.createVariable('lon_psi', 'd', ('eta_psi', 'xi_psi',), zlib=myzlib, fill_value=grdROMS.fillval)
    vnc.long_name = 'Longitude of PSI-points'
    vnc.units = 'degree_east'
    vnc.standard_name = 'longitude'
    vnc[:, :] = grdROMS.lon_psi

    vnc = f1.createVariable('h', 'd', ('eta_rho', 'xi_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
    vnc.long_name = "Bathymetry at RHO-points"
    vnc.units = "meter"
    vnc.coordinates = "lat_rho lon_rho"
    vnc.field = "bath, scalar"
    vnc[:, :] = grdROMS.h

    vnc = f1.createVariable('s_rho', 'd', ('s_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
    vnc.long_name = "S-coordinate at RHO-points"
    vnc.valid_min = -1.
    vnc.valid_max = 0.

    if grdROMS.vtransform == 2:
        vnc.standard_name = "ocean_s_coordinate_g2"
        vnc.formula_terms = "s: s_rho C: Cs_r eta: zeta depth: h depth_c: hc"
    if grdROMS.vtransform == 1:
        vnc.standard_name = "ocean_s_coordinate_g1"
        vnc.formula_terms = "s: s_rho C: Cs_r eta: zeta depth: h depth_c: hc"
#.........这里部分代码省略.........
开发者ID:trondkr,项目名称:model2roms,代码行数:103,代码来源:IOBry.py

示例2: createinitfile

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import link [as 别名]
def createinitfile(confM2R, ntime, var, data1=None, data2=None, data3=None, data4=None):
    # Create initial file for use with ROMS. This is the same as extracting time 0 from
    # the climatology file.
    if (confM2R.myformat == 'NETCDF4'):
        myzlib = True
    else:
        myzlib = False

    grdROMS = confM2R.grdROMS

    if not grdROMS.ioInitInitialized:
        grdROMS.ioInitInitialized = True
        if os.path.exists(confM2R.initname):
            os.remove(confM2R.initname)

        f1 = Dataset(confM2R.initname, mode='w', format=confM2R.myformat)
        f1.title = "Initial forcing file (INIT) used for foring of the ROMS model"
        f1.description = "Created for the %s grid file" % (confM2R.romsgridpath)
        f1.grd_file = "Gridfile: %s" % (confM2R.romsgridpath)
        f1.history = "Created " + time.ctime(time.time())
        f1.source = "Trond Kristiansen ([email protected])"
        f1.type = "File in %s format created using MODEL2ROMS" % (confM2R.myformat)
        f1.link = "https://github.com/trondkr/model2roms"
        f1.Conventions = "CF-1.0"

        # Define dimensions
        f1.createDimension('xi_rho', grdROMS.xi_rho)
        f1.createDimension('eta_rho', grdROMS.eta_rho)
        f1.createDimension('xi_u', grdROMS.xi_u)
        f1.createDimension('eta_u', grdROMS.eta_u)
        f1.createDimension('xi_v', grdROMS.xi_v)
        f1.createDimension('eta_v', grdROMS.eta_v)
        f1.createDimension('xi_psi', grdROMS.xi_psi)
        f1.createDimension('eta_psi', grdROMS.eta_psi)
        f1.createDimension('ocean_time', None)
        f1.createDimension('s_rho', len(grdROMS.s_rho))
        f1.createDimension('s_w', len(grdROMS.s_w))

        vnc = f1.createVariable('lon_rho', 'd', ('eta_rho', 'xi_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Longitude of RHO-points'
        vnc.units = 'degree_east'
        vnc.standard_name = 'longitude'
        vnc[:, :] = grdROMS.lon_rho

        vnc = f1.createVariable('lat_rho', 'd', ('eta_rho', 'xi_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Latitude of RHO-points'
        vnc.units = 'degree_north'
        vnc.standard_name = 'latitude'
        vnc[:, :] = grdROMS.lat_rho

        vnc = f1.createVariable('lon_u', 'd', ('eta_u', 'xi_u',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Longitude of U-points'
        vnc.units = 'degree_east'
        vnc.standard_name = 'longitude'
        vnc[:, :] = grdROMS.lon_u

        vnc = f1.createVariable('lat_u', 'd', ('eta_u', 'xi_u',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Latitude of U-points'
        vnc.units = 'degree_north'
        vnc.standard_name = 'latitude'
        vnc[:, :] = grdROMS.lat_u

        vnc = f1.createVariable('lon_v', 'd', ('eta_v', 'xi_v',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Longitude of V-points'
        vnc.units = 'degree_east'
        vnc.standard_name = 'longitude'
        vnc[:, :] = grdROMS.lon_v

        vnc = f1.createVariable('lat_v', 'd', ('eta_v', 'xi_v',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Latitude of V-points'
        vnc.units = 'degree_north'
        vnc.standard_name = 'latitude'
        vnc[:, :] = grdROMS.lat_v

        vnc = f1.createVariable('lat_psi', 'd', ('eta_psi', 'xi_psi',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Latitude of PSI-points'
        vnc.units = 'degree_north'
        vnc.standard_name = 'latitude'
        vnc[:, :] = grdROMS.lat_psi

        vnc = f1.createVariable('lon_psi', 'd', ('eta_psi', 'xi_psi',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Longitude of PSI-points'
        vnc.units = 'degree_east'
        vnc.standard_name = 'longitude'
        vnc[:, :] = grdROMS.lon_psi

        vnc = f1.createVariable('h', 'd', ('eta_rho', 'xi_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Final bathymetry at RHO points'
        vnc.units = 'meter'
        vnc.field = "bath, scalar"
        vnc[:, :] = grdROMS.h

        vnc = f1.createVariable('s_rho', 'd', ('s_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = "S-coordinate at RHO-points"
        vnc.valid_min = -1.
        vnc.valid_max = 0.
        vnc.positive = "up"
        if grdROMS.vtransform == 2:
            vnc.standard_name = "ocean_s_coordinate_g2"
            vnc.formula_terms = "s: s_rho C: Cs_r eta: zeta depth: h depth_c: hc"
#.........这里部分代码省略.........
开发者ID:trondkr,项目名称:model2roms,代码行数:103,代码来源:IOinitial.py

示例3: writeclimfile

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import link [as 别名]
def writeclimfile(confM2R, ntime, myvar, data1=None, data2=None, data3=None, data4=None):
    if confM2R.myformat == 'NETCDF4':
        myzlib = True
    else:
        myzlib = False

    grdROMS = confM2R.grdROMS

    if confM2R.grdROMS.ioClimInitialized is False:
        confM2R.grdROMS.ioClimInitialized = True
        if os.path.exists(confM2R.climname):
            os.remove(confM2R.climname)

        f1 = Dataset(confM2R.climname, mode='w', format=confM2R.myformat)
        f1.title = "Climatology forcing file (CLIM) used for forcing the ROMS model"
        f1.description = "Created for grid file: %s" % (confM2R.romsgridpath)
        f1.grd_file = "Gridfile: %s" % (confM2R.romsgridpath)
        f1.history = "Created " + time.ctime(time.time())
        f1.source = "{} ({})".format(confM2R.authorname,confM2R.authoremail)
        f1.type = "File in %s format created using MODEL2ROMS" % (confM2R.myformat)
        f1.link = "https://github.com/trondkr/model2roms"
        f1.Conventions = "CF-1.0"

        # Define dimensions
        f1.createDimension('xi_rho', grdROMS.xi_rho)
        f1.createDimension('eta_rho', grdROMS.eta_rho)
        f1.createDimension('xi_u', grdROMS.xi_u)
        f1.createDimension('eta_u', grdROMS.eta_u)
        f1.createDimension('xi_v', grdROMS.xi_v)
        f1.createDimension('eta_v', grdROMS.eta_v)
        f1.createDimension('xi_psi', grdROMS.xi_psi)
        f1.createDimension('eta_psi', grdROMS.eta_psi)
        f1.createDimension('s_rho', len(grdROMS.s_rho))
        f1.createDimension('s_w', len(grdROMS.s_w))
        if confM2R.isclimatology:
            f1.createDimension('clim_time', 12)
        else:
            f1.createDimension('ocean_time', None)

        vnc = f1.createVariable('lon_rho', 'd', ('eta_rho', 'xi_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Longitude of RHO-points'
        vnc.units = 'degree_east'
        vnc.standard_name = 'longitude'
        vnc[:, :] = grdROMS.lon_rho

        vnc = f1.createVariable('lat_rho', 'd', ('eta_rho', 'xi_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Latitude of RHO-points'
        vnc.units = 'degree_north'
        vnc.standard_name = 'latitude'
        vnc[:, :] = grdROMS.lat_rho

        vnc = f1.createVariable('lon_u', 'd', ('eta_u', 'xi_u',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Longitude of U-points'
        vnc.units = 'degree_east'
        vnc.standard_name = 'longitude'
        vnc[:, :] = grdROMS.lon_u

        vnc = f1.createVariable('lat_u', 'd', ('eta_u', 'xi_u',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Latitude of U-points'
        vnc.units = 'degree_north'
        vnc.standard_name = 'latitude'
        vnc[:, :] = grdROMS.lat_u

        vnc = f1.createVariable('lon_v', 'd', ('eta_v', 'xi_v',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Longitude of V-points'
        vnc.units = 'degree_east'
        vnc.standard_name = 'longitude'
        vnc[:, :] = grdROMS.lon_v

        vnc = f1.createVariable('lat_v', 'd', ('eta_v', 'xi_v',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Latitude of V-points'
        vnc.units = 'degree_north'
        vnc.standard_name = 'latitude'
        vnc[:, :] = grdROMS.lat_v

        vnc = f1.createVariable('lat_psi', 'd', ('eta_psi', 'xi_psi',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Latitude of PSI-points'
        vnc.units = 'degree_north'
        vnc.standard_name = 'latitude'
        vnc[:, :] = grdROMS.lat_psi

        vnc = f1.createVariable('lon_psi', 'd', ('eta_psi', 'xi_psi',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Longitude of PSI-points'
        vnc.units = 'degree_east'
        vnc.standard_name = 'longitude'
        vnc[:, :] = grdROMS.lon_psi

        vnc = f1.createVariable('h', 'd', ('eta_rho', 'xi_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Bathymetry at RHO-points'
        vnc.units = 'meter'
        vnc.field = "bath, scalar"
        vnc[:, :] = grdROMS.h

        vnc = f1.createVariable('f', 'd', ('eta_rho', 'xi_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
        vnc.long_name = 'Coriolis parameter at RHO-points'
        vnc.units = 'second-1'
        vnc.field = "Coriolis, scalar"
        vnc[:, :] = grdROMS.f

        vnc = f1.createVariable('pm', 'd', ('eta_rho', 'xi_rho',), zlib=myzlib, fill_value=grdROMS.fillval)
#.........这里部分代码省略.........
开发者ID:trondkr,项目名称:model2roms,代码行数:103,代码来源:IOwrite.py

示例4: createNetCDFFileUV

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import link [as 别名]
def createNetCDFFileUV(grdROMS, outfilename, myformat, mytype):

    if (myformat=='NETCDF4'):
        myzlib = True
    else:
        myzlib = False

    if os.path.exists(outfilename):
        os.remove(outfilename)
    print(('Creating atmospheric forcing file for UV wind - %s'%(outfilename)))

    f1 = Dataset(outfilename, mode='w', format=myformat)
    f1.title="Atmospheric frocing file used by the ROMS model"
    f1.description="Created for the %s grid file"%(grdROMS.grdName)
    f1.grdFile="%s"%(grdROMS.grdfilename)
    f1.history = 'Created ' + time.ctime(time.time())
    f1.source = 'Trond Kristiansen ([email protected])'
    f1.type = "File in %s format created using MODEL2ROMS"%(myformat)
    f1.link = "https://github.com/trondkr/model2roms"
    f1.Conventions = "CF-1.0"

    """ Define dimensions """
    f1.createDimension('xi_rho',  grdROMS.xi_rho)
    f1.createDimension('eta_rho', grdROMS.eta_rho)
    f1.createDimension('wind_time', None)
    
    vnc = f1.createVariable('lon_rho', 'd', ('eta_rho','xi_rho',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = 'Longitude of RHO-points'
    vnc.units = 'degree_east'
    vnc.standard_name = 'longitude'
    vnc[:,:] = grdROMS.lon_rho

    vnc = f1.createVariable('lat_rho', 'd', ('eta_rho','xi_rho',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = 'Latitude of RHO-points'
    vnc.units = 'degree_north'
    vnc.standard_name = 'latitude'
    vnc[:,:] = grdROMS.lat_rho

    v_time = f1.createVariable('wind_time', 'd', ('wind_time',),zlib=myzlib, fill_value=grdROMS.fill_value)
    
    if mytype == "NORESM":
        v_time.long_name = 'Days since 1800-01-01 00:00:00'
        v_time.units = 'Days since 1800-01-01 00:00:00'
    else:
        v_time.long_name = 'Days since 1948-01-01 00:00:00'
        v_time.units = 'Days since 1948-01-01 00:00:00'
    v_time.field = 'time, scalar, series'
    v_time.calendar='noleap'

    v_temp_west=f1.createVariable('Vwind', 'f', ('wind_time', 'eta_rho', 'xi_rho',),zlib=myzlib, fill_value=grdROMS.fill_value)
    v_temp_west.long_name = "Eta-component of wind"
    v_temp_west.units = "meter second-1"
    v_temp_west.field = "Vwind, scalar, series"
    v_temp_west.missing_value = grdROMS.fill_value
    v_temp_west.time = "wind_time"

    v_temp_west=f1.createVariable('Uwind', 'f', ('wind_time', 'eta_rho', 'xi_rho',),zlib=myzlib, fill_value=grdROMS.fill_value)
    v_temp_west.long_name = "Xi-component of wind"
    v_temp_west.units = "meter second-1"
    v_temp_west.field = "Uwind, scalar, series"
    v_temp_west.missing_value = grdROMS.fill_value
    v_temp_west.time = "wind_time"

    f1.close()
开发者ID:trondkr,项目名称:model2roms,代码行数:66,代码来源:IOatmos.py

示例5: createBryFile

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import link [as 别名]
def createBryFile(grdROMS, outfilename, writeIce, mytype, myformat):

    if (myformat=='NETCDF4'):
        myzlib = True
    else:
        myzlib = False

    if os.path.exists(outfilename):
        os.remove(outfilename)
    print 'Creating initial Boundary (BRY) file %s'%(outfilename)

    f1 = Dataset(outfilename, mode='w', format=myformat)
    f1.title="Boundary forcing file (BRY) used for forcing of the ROMS model"
    f1.description="Created for the %s grid file"%(grdROMS.grdName)
    f1.grdFile="%s"%(grdROMS.grdfilename)
    f1.history = 'Created ' + time.ctime(time.time())
    f1.source = 'Trond Kristiansen ([email protected])'
    f1.type = "File in %s format created using MODEL2ROMS"%(myformat)
    f1.link = "https://github.com/trondkr/model2roms"
    f1.Conventions = "CF-1.0"

    """ Define dimensions """
    f1.createDimension('xi_rho',  grdROMS.xi_rho)
    f1.createDimension('eta_rho', grdROMS.eta_rho)
    f1.createDimension('xi_u',    grdROMS.xi_u)
    f1.createDimension('eta_u',   grdROMS.eta_u)
    f1.createDimension('xi_v',    grdROMS.xi_v)
    f1.createDimension('eta_v',   grdROMS.eta_v)
    f1.createDimension('xi_psi',    grdROMS.xi_psi)
    f1.createDimension('eta_psi',   grdROMS.eta_psi)
    f1.createDimension('ocean_time', None)
    f1.createDimension('s_rho', len(grdROMS.s_rho))
    f1.createDimension('s_w', len(grdROMS.s_w))

    vnc = f1.createVariable('lon_rho', 'd', ('eta_rho','xi_rho',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = 'Longitude of RHO-points'
    vnc.units = 'degree_east'
    vnc.standard_name = 'longitude'
    vnc[:,:] = grdROMS.lon_rho

    vnc = f1.createVariable('lat_rho', 'd', ('eta_rho','xi_rho',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = 'Latitude of RHO-points'
    vnc.units = 'degree_north'
    vnc.standard_name = 'latitude'
    vnc[:,:] = grdROMS.lat_rho

    vnc = f1.createVariable('lon_u', 'd', ('eta_u','xi_u',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = 'Longitude of U-points'
    vnc.units = 'degree_east'
    vnc.standard_name = 'longitude'
    vnc[:,:] = grdROMS.lon_u

    vnc = f1.createVariable('lat_u', 'd', ('eta_u','xi_u',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = 'Latitude of U-points'
    vnc.units = 'degree_north'
    vnc.standard_name = 'latitude'
    vnc[:,:] = grdROMS.lat_u

    vnc = f1.createVariable('lon_v', 'd', ('eta_v','xi_v',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = 'Longitude of V-points'
    vnc.units = 'degree_east'
    vnc.standard_name = 'longitude'
    vnc[:,:] = grdROMS.lon_v

    vnc = f1.createVariable('lat_v', 'd', ('eta_v','xi_v',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = 'Latitude of V-points'
    vnc.units = 'degree_north'
    vnc.standard_name = 'latitude'
    vnc[:,:] = grdROMS.lat_v

    vnc = f1.createVariable('lat_psi', 'd', ('eta_psi','xi_psi',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = 'Latitude of PSI-points'
    vnc.units = 'degree_north'
    vnc.standard_name = 'latitude'
    vnc[:,:] = grdROMS.lat_psi

    vnc = f1.createVariable('lon_psi', 'd', ('eta_psi','xi_psi',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = 'Longitude of PSI-points'
    vnc.units = 'degree_east'
    vnc.standard_name = 'longitude'
    vnc[:,:] = grdROMS.lon_psi

    vnc = f1.createVariable('h', 'd', ('eta_rho','xi_rho',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = "Bathymetry at RHO-points"
    vnc.units = "meter"
    vnc.coordinates ="lat_rho lon_rho"
    vnc.field = "bath, scalar"
    vnc[:,:] = grdROMS.h

    vnc = f1.createVariable('s_rho', 'd', ('s_rho',),zlib=myzlib, fill_value=grdROMS.fill_value)
    vnc.long_name = "S-coordinate at RHO-points"
    vnc.valid_min = -1.
    vnc.valid_max = 0.

    if grdROMS.vtransform==2:
        vnc.standard_name = "ocean_s_coordinate_g2"
        vnc.formula_terms = "s: s_rho C: Cs_r eta: zeta depth: h depth_c: hc"
    if grdROMS.vtransform==1:
        vnc.standard_name = "ocean_s_coordinate_g1"
        vnc.formula_terms = "s: s_rho C: Cs_r eta: zeta depth: h depth_c: hc"
#.........这里部分代码省略.........
开发者ID:raytl,项目名称:model2roms,代码行数:103,代码来源:IOBry.py


注:本文中的netCDF4.Dataset.link方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。