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


Python Dataset.Author方法代码示例

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


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

示例1: writeNC

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import Author [as 别名]
    def writeNC(self,outfile):
        """
        Export the grid variables to a netcdf file
        """
        from netCDF4 import Dataset
        from soda.dataio.suntans.suntans_ugrid import ugrid
        
        nc = Dataset(outfile, 'w', format='NETCDF4_CLASSIC')
        nc.Description = 'Unstructured grid file'
        nc.Author = ''
        #nc.Created = datetime.now().isoformat()

        nc.createDimension('Nc', self.Nc)
        nc.createDimension('Np', self.Np)
        try:
            nc.createDimension('Ne', self.Ne)
        except:
            print 'No dimension: Ne'
        nc.createDimension('Nk', self.Nkmax)
        nc.createDimension('Nkw', self.Nkmax+1)
        nc.createDimension('numsides', self.MAXFACES)
        nc.createDimension('two', 2)
        nc.createDimension('time', 0) # Unlimited
        
        # Write the grid variables
        def write_nc_var(var, name, dimensions, attdict, dtype='f8'):
            tmp=nc.createVariable(name, dtype, dimensions)
            for aa in attdict.keys():
                tmp.setncattr(aa,attdict[aa])
            nc.variables[name][:] = var
    
        gridvars = ['suntans_mesh','cells','face','nfaces',\
             'edges','neigh','grad','xp','yp','xv','yv','xe','ye',\
            'normal','n1','n2','df','dg','def',\
            'Ac','dv','dz','z_r','z_w','Nk','Nke','mark']
        
        self.Nk += 1 # Set to one-base in the file (reset to zero-base after)
        self.suntans_mesh=[0]  
        for vv in gridvars:
            if self.__dict__.has_key(vv):
                if self.VERBOSE:
                    print 'Writing variables: %s'%vv

                write_nc_var(self[vv],vv,\
                        ugrid[vv]['dimensions'],\
                        ugrid[vv]['attributes'],\
                        dtype=ugrid[vv]['dtype'])
            
            # Special treatment for "def"
            if vv == 'def' and self.__dict__.has_key('DEF'):
                if self.VERBOSE:
                    print 'Writing variables: %s'%vv
                write_nc_var(self['DEF'],vv,ugrid[vv]['dimensions'],\
                        ugrid[vv]['attributes'],\
                        dtype=ugrid[vv]['dtype'])

        nc.close()
        self.Nk -= 1 # set back to zero base
开发者ID:mrayson,项目名称:soda,代码行数:60,代码来源:hybridgrid.py

示例2: create_nc

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import Author [as 别名]
    def create_nc(self,ncfile):
        """
        Create the particle netcdf file

        NetCDF variable and dimension names are consistent with partrac data.
        """

        if self.verbose:
            print '\nInitialising particle netcdf file: %s...\n'%ncfile
            
        # Global Attributes
        nc = Dataset(ncfile, 'w', format='NETCDF4_CLASSIC')
        nc.Description = 'Particle trajectory file'
        nc.Author = os.getenv('USER')
        nc.Created = datetime.now().isoformat()

        # Dimensions
        nc.createDimension('ntrac', self.N)
        nc.createDimension('nt', 0) # Unlimited
        
        # Create variables
        def create_nc_var( name, dimensions, attdict, dtype='f8'):
            tmp=nc.createVariable(name, dtype, dimensions)
            for aa in attdict.keys():
                tmp.setncattr(aa,attdict[aa])
          
        basetimestr = 'seconds since %s'%(datetime.strftime(self.basetime,\
            '%Y-%m-%d %H:%M:%S'))
        create_nc_var('tp',('nt'),{'units':basetimestr\
            ,'long_name':"time at drifter locations"},dtype='f8')
        create_nc_var('xp',('ntrac','nt'),{'units':'m',\
            'long_name':"Easting coordinate of drifter",'time':'tp'},dtype='f8')
        create_nc_var('yp',('ntrac','nt'),{'units':'m',\
            'long_name':"Northing coordinate of drifter",'time':'tp'},dtype='f8')
        create_nc_var('zp',('ntrac','nt'),{'units':'m',\
            'long_name':"vertical position of drifter (negative is downward from surface)",'time':'tp'},dtype='f8')
        if self.has_age:
            create_nc_var('age',('ntrac','nt'),{'units':'seconds',\
                'long_name':"Particle age",'time':'tp'},dtype='f8')
            create_nc_var('agemax',('ntrac','nt'),{'units':'seconds',\
                'long_name':"Maximum particle age",'time':'tp'},dtype='f8')

        # Keep the pointer to the open file as an attribute
        self._nc = nc
开发者ID:jadelson,项目名称:suntanspy,代码行数:46,代码来源:particles.py

示例3: initParticleNC

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import Author [as 别名]
    def initParticleNC(self,outfile,Np,age=False):
        """
        Export the grid variables to a netcdf file
        """
        import os

        if self.verbose:
            print '\nInitialising particle netcdf file: %s...\n'%outfile
            
        # Global Attributes
        nc = Dataset(outfile, 'w', format='NETCDF4_CLASSIC')
        nc.Description = 'Particle trajectory file'
        nc.Author = os.getenv('USER')
        nc.Created = datetime.now().isoformat()

        #tseas = self.time_sec[1] - self.time_sec[0]
        #nsteps = np.floor(tseas/self.dt)
        #nc.nsteps = '%f (number of linear interpolation steps in time between model outputs)'%nsteps
        #nc.tseas = '%d (Time step (seconds) between model outputs'%tseas
        #nc.dt = '%f (Particle model time steps [seconds])'%self.dt
        nc.dataset_location = '%s'%self.ncfile

        # Dimensions
        nc.createDimension('ntrac', Np)
        nc.createDimension('nt', 0) # Unlimited
        
        # Create variables
        def create_nc_var( name, dimensions, attdict, dtype='f8'):
            tmp=nc.createVariable(name, dtype, dimensions)
            for aa in attdict.keys():
                tmp.setncattr(aa,attdict[aa])
          
        create_nc_var('tp',('nt'),{'units':'seconds since 1990-01-01 00:00:00','long_name':"time at drifter locations"},dtype='f8')
        create_nc_var('xp',('ntrac','nt'),{'units':'m','long_name':"Easting coordinate of drifter",'time':'tp'},dtype='f8')
        create_nc_var('yp',('ntrac','nt'),{'units':'m','long_name':"Northing coordinate of drifter",'time':'tp'},dtype='f8')
        create_nc_var('zp',('ntrac','nt'),{'units':'m','long_name':"vertical position of drifter (negative is downward from surface)",'time':'tp'},dtype='f8')
	if age:
	    create_nc_var('age',('ntrac','nt'),{'units':'seconds','long_name':"Particle age",'time':'tp'},dtype='f8')
	    create_nc_var('agemax',('ntrac','nt'),{'units':'seconds','long_name':"Maximum particle age",'time':'tp'},dtype='f8')

        nc.close()
开发者ID:mrayson,项目名称:soda,代码行数:43,代码来源:suntrack.py

示例4: BaraKuda

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import Author [as 别名]
id_lon  = f_out.createVariable('nav_lon','f4',('y','x',))
id_lat  = f_out.createVariable('nav_lat','f4',('y','x',))

id_atl  = f_out.createVariable('tmaskatl' ,'f4',('y','x',)) ; id_atl.long_name = 'Atlantic Basin'
id_pac  = f_out.createVariable('tmaskpac' ,'f4',('y','x',)) ; id_pac.long_name = 'Pacific Basin'
id_ind  = f_out.createVariable('tmaskind' ,'f4',('y','x',)) ; id_ind.long_name = 'Indian Basin'
id_soc  = f_out.createVariable('tmasksoc' ,'f4',('y','x',)) ; id_soc.long_name = 'Southern Basin'
id_inp  = f_out.createVariable('tmaskinp' ,'f4',('y','x',)) ;  id_inp.long_name = 'Indo-Pacific Basin'


# Filling variables:
id_lat[:,:]    =   xlat[:,:]
id_lon[:,:]    =   xlon[:,:]

id_atl[:,:]  =  mask_atl[:,:]
id_pac[:,:]  =  mask_pac[:,:]
id_ind[:,:]  =  mask_ind[:,:]
id_soc[:,:]  =  mask_soc[:,:]

id_inp[:,:]  =  mask_inp[:,:]


f_out.About  = 'ORCA1 main oceanic basin land-sea mask created from '+cf_mm
f_out.Author = ' Generated with "orca025_create_basin_mask_from_meshmask.py" of BaraKuda (https://github.com/brodeau/barakuda)'

f_out.close()


print cf_out+' sucessfully created!'

开发者ID:brodeau,项目名称:barakuda,代码行数:31,代码来源:orca025_create_basin_mask_from_meshmask.py

示例5: float

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import Author [as 别名]


        id_t[jrec2write]     = float(jy)
        id_zw[:]              = zgdepw[:]
        id_zt[:]              = zgdept[:]        
        id_v01[jrec2write,:] = rmean_sss0_deep_jfm[:]
        id_v02[jrec2write,:] = rmean_sss0_deep_m03[:]
        id_v03[jrec2write,:] = nbp_deeper_zcrit[:]
        id_v04[jrec2write,:] = vprof_sig0_ann[:]
        id_v05[jrec2write,:] = vprof_sig0_jfm[:]
        id_v06[jrec2write,:] = vprof_sig0_m03[:]        
        
        f_out.box_coordinates = cbox+' => '+str(i1)+','+str(j1)+' -> '+str(i2-1)+','+str(j2-1)
        f_out.box_file        = FILE_DEF_BOXES
        f_out.Author          = 'L. Brodeau ('+cname_script+' of Barakuda)'
    
    else:
        vt  = f_out.variables['time']
        jrec2write = len(vt)
        v01 = f_out.variables['SSsig0_jfm']
        v02 = f_out.variables['SSsig0_m03']
        v03 = f_out.variables['Nbp_w_deep']
        v04 = f_out.variables['sig0_ann']
        v05 = f_out.variables['sig0_jfm']
        v06 = f_out.variables['sig0_m03']
            
        vt [jrec2write]   = float(jy)
        v01[jrec2write,:] = rmean_sss0_deep_jfm[:]
        v02[jrec2write,:] = rmean_sss0_deep_m03[:]
        v03[jrec2write,:] = nbp_deeper_zcrit[:]
开发者ID:OscarEReyes,项目名称:barakuda,代码行数:32,代码来源:zcrit_conv.py

示例6: Brodeau

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import Author [as 别名]
id_atl  = f_out.createVariable('tmaskatl' ,'f4',('y','x',)) ; id_atl.long_name = 'Atlantic Basin'
id_pac  = f_out.createVariable('tmaskpac' ,'f4',('y','x',)) ; id_pac.long_name = 'Pacific Basin'
id_ind  = f_out.createVariable('tmaskind' ,'f4',('y','x',)) ; id_ind.long_name = 'Indian Basin'
id_soc  = f_out.createVariable('tmasksoc' ,'f4',('y','x',)) ; id_soc.long_name = 'Southern Basin'
id_inp  = f_out.createVariable('tmaskinp' ,'f4',('y','x',)) ;  id_inp.long_name = 'Indo-Pacific Basin'


# Filling variables:
id_lat[:,:]    =   xlat[:,:]
id_lon[:,:]    =   xlon[:,:]

id_atl[:,:]  =  mask_atl[:,:]
id_pac[:,:]  =  mask_pac[:,:]
id_ind[:,:]  =  mask_ind[:,:]
id_soc[:,:]  =  mask_soc[:,:]

id_inp[:,:]  =  mask_inp[:,:]


f_out.About  = 'ORCA1 main oceans basin land-sea mask created from '+cf_mm
f_out.Author = 'L. Brodeau (lb_nemo_create_basin_mask.py of PYLB)'


f_out.close()




print cf_out+' sucessfully created!'

开发者ID:OscarEReyes,项目名称:barakuda,代码行数:31,代码来源:orca025_create_basin_mask_from_meshmask.py

示例7: range

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import Author [as 别名]
        for jt in range(nt):
            id_t[jt]   = vtime[jt]
            id_v01[jt] = rmean_sst[jt,jb]
            id_v02[jt] = rmean_sss[jt,jb]
            
            Xbox[:,:] = XSST[jt,j1:j2,i1:i2]
            Xbox[idx_msk] = -9999.
            id_x01[jt,:,:] = Xbox[:,:]

            Xbox[:,:] = XSSS[jt,j1:j2,i1:i2]
            Xbox[idx_msk] = -9999.
            id_x02[jt,:,:] = Xbox[:,:]

            
        f_out.Author = 'Generated with "ssx_boxes.py" of BaraKuda (https://github.com/brodeau/barakuda)'

    else:
        vt = f_out.variables['time']
        jrec2write = len(vt)
        v01 = f_out.variables[cv_sst+'_sa']
        x01 = f_out.variables[cv_sst]
        v02 = f_out.variables[cv_sss+'_sa']
        x02 = f_out.variables[cv_sss]
        for jt in range(nt):
            vt [jrec2write+jt] = vtime[jt]
            v01[jrec2write+jt] = rmean_sst[jt,jb]
            v02[jrec2write+jt] = rmean_sss[jt,jb]

            Xbox[:,:] = XSST[jt,j1:j2,i1:i2] ; Xbox[idx_msk] = -9999.
            x01[jrec2write+jt,:,:] = Xbox[:,:]
开发者ID:brodeau,项目名称:barakuda,代码行数:32,代码来源:ssx_boxes.py

示例8: wrt_1d_series

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import Author [as 别名]
def wrt_1d_series(vt, vd, cvar, cinfo,                   
                  cu_t='unknown', cu_d='unknown', cln_d='unknown', nsmooth=0,
                  vd2=[], vd3=[], vd4=[], vd5=[],
                  cvar2='', cvar3='', cvar4='', cvar5='',
                  cln_d2='', cln_d3='', cln_d4='', cln_d5='',):

    cf_o  = cvar+'_'+cinfo+'.nc'
    
    lsmooth = False

    if nsmooth > 0:
        import barakuda_stat as bs
        lsmooth = True

        if nsmooth == 11:
            vd_sm = bs.running_mean_11(vd, l_fill_bounds=False)
        elif nsmooth == 5:
            vd_sm = bs.running_mean_5(vd, l_fill_bounds=False)
        else:
            print 'ERROR: wrt_1d_series.barakuda_ncio => smoothing with nsmooth='+str(nsmooth)+' not supported!'; sys.exit(0)


    f_o = Dataset(cf_o, 'w', format='NETCDF3_CLASSIC')

    nt = len(vt)
    if len(vd) != nt:  print 'ERROR: wrt_1d_series.barakuda_ncio => data & time have different lengths!'; sys.exit(0)

    l_do_v2=False ; l_do_v3=False ; l_do_v4=False ; l_do_v5=False
    if len(vd2) == nt: l_do_v2=True
    if len(vd3) == nt: l_do_v3=True
    if len(vd4) == nt: l_do_v4=True
    if len(vd5) == nt: l_do_v5=True


    f_o.createDimension('time', None)
    id_t = f_o.createVariable('time','f4',('time',)) ;  id_t.units = cu_t

    id_d = f_o.createVariable(cvar,'f4',('time',))
    id_d.units = cu_d ;  id_d.long_name = cln_d

    if l_do_v2: id_d2 = f_o.createVariable(cvar2,'f4',('time',)); id_d2.units = cu_d; id_d2.long_name = cln_d2
    if l_do_v3: id_d3 = f_o.createVariable(cvar3,'f4',('time',)); id_d3.units = cu_d; id_d3.long_name = cln_d3
    if l_do_v4: id_d4 = f_o.createVariable(cvar4,'f4',('time',)); id_d4.units = cu_d; id_d4.long_name = cln_d4
    if l_do_v5: id_d5 = f_o.createVariable(cvar5,'f4',('time',)); id_d5.units = cu_d; id_d5.long_name = cln_d5


    if lsmooth:
        id_sm = f_o.createVariable(cvar+'_'+str(nsmooth)+'yrm','f4',('time',))
        id_sm.units = cu_d ;  id_sm.long_name = str(nsmooth)+'-year running mean of '+cln_d


    for jt in range(nt):
        id_t[jt]   = vt[jt]
        id_d[jt]   = vd[jt]
        if lsmooth: id_sm[jt] = vd_sm[jt]
        if l_do_v2: id_d2[jt] = vd2[jt]
        if l_do_v3: id_d3[jt] = vd3[jt]
        if l_do_v4: id_d4[jt] = vd4[jt]
        if l_do_v5: id_d5[jt] = vd5[jt]
        
    f_o.Author = 'L. Brodeau (barakuda_ncio.py of Barakuda)'
    f_o.close()
    print ' * wrt_1d_series => '+cf_o+' written!\n'
    
    return 0
开发者ID:OscarEReyes,项目名称:barakuda,代码行数:67,代码来源:barakuda_ncio.py

示例9: float

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import Author [as 别名]
            jrec2write = 0

            # Creating Dimensions:
            f_out.createDimension('time', None)
            f_out.createDimension('deptht', nk)

            # Creating variables:
            id_t = f_out.createVariable('time','f4',('time',)) ;      id_t.units = 'year'
            id_z = f_out.createVariable('deptht','f4',('deptht',)) ;  id_z.units = 'm'
            id_v01   = f_out.createVariable(cvar ,'f4',('time','deptht',))
            id_v01.long_name = 'Horizontally-averaged '+cvar+': '+cocean
            # Writing depth vector
            id_z[:] = vdepth[:]
            id_t[jrec2write] = float(jyear)+0.5
            id_v01[jrec2write,:] = Vf[:]
            f_out.Author = 'L. Brodeau ('+cnexec+' of Barakuda)'

        else:
            vt = f_out.variables['time']
            jrec2write = len(vt)
            v01 = f_out.variables[cvar]
            vt[jrec2write] = float(jyear)+0.5
            v01[jrec2write,:] = Vf[:]

        f_out.close()
        print cf_out+' written!'




开发者ID:brodeau,项目名称:barakuda,代码行数:28,代码来源:mean.py

示例10: writeNC

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import Author [as 别名]
    def writeNC(self, outfile):
        """
        This function is used to create the netcdf file
        """
        print 'under developing'
        
        ####create netcdf File####
        nc = Dataset(outfile, 'w', format='NETCDF4_CLASSIC')
        nc.Description = 'SUNTANS History file'
        nc.Author = ''
        nc.Created = datetime.now().isoformat()
        ####Create dimensions####
        nc.createDimension('NVwind', self.Nstation)
        nc.createDimension('NTair', self.Nstation)
        nc.createDimension('Nrain', self.Nstation)
        nc.createDimension('NUwind', self.Nstation)
        nc.createDimension('NPair', self.Nstation)
	nc.createDimension('NRH', self.Nstation)
	nc.createDimension('Ncloud', self.Nstation)
	nc.createDimension('nt', self.Nt)
	nc.close()

	####adding variables####
        self.create_nc_var(outfile,'x_Vwind',('NVwind'),{'long_name':'Longitude at Vwind','units':'degrees_north'})
        self.create_nc_var(outfile,'y_Vwind',('NVwind'),{'long_name':'Latitude at Vwind','units':'degrees_east'})
        self.create_nc_var(outfile,'z_Vwind',('NVwind'),{'long_name':'Elevation at Vwind','units':'m'})

	self.create_nc_var(outfile,'x_Tair',('NTair'),{'long_name':'Longitude at Tair','units':'degrees_north'})
        self.create_nc_var(outfile,'y_Tair',('NTair'),{'long_name':'Latitude at Tair','units':'degrees_east'})
        self.create_nc_var(outfile,'z_Tair',('NTair'),{'long_name':'Elevation at Tair','units':'m'})

	self.create_nc_var(outfile,'x_rain',('Nrain'),{'long_name':'Longitude at rain','units':'degrees_north'})
        self.create_nc_var(outfile,'y_rain',('Nrain'),{'long_name':'Latitude at rain','units':'degrees_east'})
        self.create_nc_var(outfile,'z_rain',('Nrain'),{'long_name':'Elevation at rain','units':'m'})

	self.create_nc_var(outfile,'x_Uwind',('NUwind'),{'long_name':'Longitude at Uwind','units':'degrees_north'})
        self.create_nc_var(outfile,'y_Uwind',('NUwind'),{'long_name':'Latitude at Uwind','units':'degrees_east'})
        self.create_nc_var(outfile,'z_Uwind',('NUwind'),{'long_name':'Elevation at Uwind','units':'m'})

	self.create_nc_var(outfile,'x_Pair',('NPair'),{'long_name':'Longitude at Pair','units':'degrees_north'})
        self.create_nc_var(outfile,'y_Pair',('NPair'),{'long_name':'Latitude at Pair','units':'degrees_east'})
        self.create_nc_var(outfile,'z_Pair',('NPair'),{'long_name':'Elevation at Pair','units':'m'})

	self.create_nc_var(outfile,'x_RH',('NRH'),{'long_name':'Longitude at RH','units':'degrees_north'})
        self.create_nc_var(outfile,'y_RH',('NRH'),{'long_name':'Latitude at RH','units':'degrees_east'})
        self.create_nc_var(outfile,'z_RH',('NRH'),{'long_name':'Elevation at RH','units':'m'})

	self.create_nc_var(outfile,'x_cloud',('Ncloud'),{'long_name':'Longitude at cloud','units':'degrees_north'})
        self.create_nc_var(outfile,'y_cloud',('Ncloud'),{'long_name':'Latitude at cloud','units':'degrees_east'})
        self.create_nc_var(outfile,'z_cloud',('Ncloud'),{'long_name':'Elevation at cloud','units':'m'})

	self.create_nc_var(outfile,'Time',('nt'),{'units':'seconds since 1990-01-01 00:00:00','long_name':'time'})
	self.create_nc_var(outfile,'Vwind',('nt','NVwind'),{'units':'m s-1','long_name':'Northward wind velocity component','coordinates':'x_Vwind,y_Vwind'})
	self.create_nc_var(outfile,'Tair',('nt','NTair'),{'units':'Celsius','long_name':'Air Temperature','coordinates':'x_Tair,y_Tair'})
	self.create_nc_var(outfile,'rain',('nt','Nrain'),{'units':'kg m2 s-1','long_name':'rain fall rate','coordinates':'x_rain,y_rain'})
	self.create_nc_var(outfile,'Uwind',('nt','NUwind'),{'long_name':'Eastward wind velocity component','coordinates':'x_Uwind,y_Uwind','units':'m s-1'})
	self.create_nc_var(outfile,'Pair',('nt','NPair'),{'units':'hPa','long_name':'Air Pressure','coordinates':'x_Pair,y_Pair'})
	self.create_nc_var(outfile,'RH',('nt','NRH'),{'units':'percent','long_name':'Relative Humidity','coordinates':'x_RH,y_RH'})
	self.create_nc_var(outfile,'cloud',('nt','Ncloud'),{'units':'dimensionless','long_name':'Cloud cover fraction','coordinates':'x_cloud,y_cloud'})
	

	######Now writting the variables######
	nc = Dataset(outfile,'a')
	nc.variables['x_Vwind'][:]=self.lat
	nc.variables['y_Vwind'][:]=self.lon
	nc.variables['z_Vwind'][:]=self.z
	
	nc.variables['x_Tair'][:]=self.lat
	nc.variables['y_Tair'][:]=self.lon
	nc.variables['z_Tair'][:]=self.z

	nc.variables['x_rain'][:]=self.lat
	nc.variables['y_rain'][:]=self.lon
	nc.variables['z_rain'][:]=self.z	
	
	nc.variables['x_Uwind'][:]=self.lat
	nc.variables['y_Uwind'][:]=self.lon
	nc.variables['z_Uwind'][:]=self.z

	nc.variables['x_Pair'][:]=self.lat
	nc.variables['y_Pair'][:]=self.lon
	nc.variables['z_Pair'][:]=self.z

	nc.variables['x_RH'][:]=self.lat
	nc.variables['y_RH'][:]=self.lon
	nc.variables['z_RH'][:]=self.z

	nc.variables['x_cloud'][:]=self.lat
	nc.variables['y_cloud'][:]=self.lon
	nc.variables['z_cloud'][:]=self.z

	nc.variables['Time'][:]=self.time
	nc.variables['Vwind'][:]=self.Vwind
	nc.variables['Tair'][:]=self.Tair
	nc.variables['rain'][:]=self.rain
	nc.variables['Uwind'][:]=self.Uwind
	nc.variables['Pair'][:]=self.Pair
	nc.variables['RH'][:]=self.RH
	nc.variables['cloud'][:]=self.cloud

#.........这里部分代码省略.........
开发者ID:fdongyu,项目名称:Hyospy-scripts,代码行数:103,代码来源:NARR.py

示例11: range

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import Author [as 别名]
        id_v03 = f_out.createVariable("S", "f4", ("time", "deptht"))
        id_v03.unit = "PSU"
        id_v03.long_name = "salinity on box " + cbox

        id_z[:] = Vdepth[:]

        for jm in range(Nt):
            id_t[jrec2write + jm] = Vtime[jm]
            id_v01[jrec2write + jm, :] = Zm1[jm, :]
            id_v02[jrec2write + jm, :] = Tm1[jm, :]
            id_v03[jrec2write + jm, :] = Sm1[jm, :]

        f_out.box_coordinates = cbox + " => " + str(i1) + "," + str(j1) + " -> " + str(i2 - 1) + "," + str(j2 - 1)
        f_out.box_file = FILE_DEF_BOXES
        f_out.Author = "L. Brodeau (" + cname_script + " of Barakuda)"

    else:
        vt = f_out.variables["time"]
        jrec2write = len(vt)
        v01 = f_out.variables["sigma0"]
        v02 = f_out.variables["theta"]
        v03 = f_out.variables["S"]

        for jm in range(Nt):
            vt[jrec2write + jm] = Vtime[jm]
            v01[jrec2write + jm, :] = Zm1[jm, :]
            v02[jrec2write + jm, :] = Tm1[jm, :]
            v03[jrec2write + jm, :] = Sm1[jm, :]

    f_out.close()
开发者ID:brodeau,项目名称:barakuda,代码行数:32,代码来源:prof_TS_z_box.py


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