Changeset 1445 in lmdz_wrf


Ignore:
Timestamp:
Feb 12, 2017, 7:31:16 PM (8 years ago)
Author:
lfita
Message:

Adding:

`add_global_PyNCplot': Function to add global attributes from 'PyNCplot' to a give

n netCDF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r1440 r1445  
    2020# add_dims: Function to add dimensions from a given netCDF object to another one
    2121# add_globattrs: Function to add global attributes from a given netCDF object to another one
     22# add_global_PyNCplot: Function to add global attributes from 'PyNCplot' to a given netCDF
    2223# add_varattrs: Function to add variables attributes from a given netCDF object to other variables in another one
    2324# add_vars: Function to add variables from a given netCDF object to another one
     
    10401041       
    10411042    return attr
     1043
     1044def add_global_PyNCplot(ObjFile, pyscript, funcname, version):
     1045    """ Function to add global attributes from 'PyNCplot' to a given netCDF
     1046      ObjFile= netCDF file object to which add the global attributes
     1047      funcname= name of the function from which file comes from
     1048      version= version of the function
     1049    """
     1050    fname = 'add_global_PyNCplot'
     1051
     1052    # Global values
     1053    ObjFile.setncattr('author', 'L. Fita')
     1054    newattr = ncvar.set_attributek(ObjFile, 'institution', unicode('Laboratoire ' +\
     1055     'de M' + unichr(233) + 't' + unichr(233) + 'orologie Dynamique'), 'U')
     1056    ObjFile.setncattr('university', 'Pierre et Marie Curie - Jussieu, Paris 06')
     1057    ObjFile.setncattr('center', 'Centre National de Recherches Scientifiques')
     1058    ObjFile.setncattr('city', 'Paris')
     1059    ObjFile.setncattr('country', 'France')
     1060    ObjFile.setncattr('tool', 'PyNCplot')
     1061    ObjFile.setncattr('url', 'http://www.xn--llusfb-5va.cat/python/PyNCplot/')
     1062    ObjFile.setncattr('script', pyscript)
     1063    ObjFile.setncattr('function', funcname)
     1064    ObjFile.setncattr('version', version)
     1065
     1066    ObjFile.sync() 
     1067
     1068    return
    10421069
    10431070def basicvardef(varobj, vstname, vlname, vunits):
Note: See TracChangeset for help on using the changeset viewer.