Changeset 1499 in lmdz_wrf


Ignore:
Timestamp:
Apr 8, 2017, 9:59:57 PM (8 years ago)
Author:
lfita
Message:

Improving and adding documentation for `DataSetSection_multivars'

Location:
trunk/tools
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/documentation/ncmanage/ncmanage.html

    r1496 r1499  
    1111      <A CLASS="lc" HREF="compute_opersvarsfiles.html" TARGET="value">compute_opersvarsfiles</A><BR>
    1212      <A CLASS="lc" HREF="curve_section.html" TARGET="value">curve_section</A><BR>
     13      <A CLASS="lc" HREF="DataSection_multivars.html" TARGET="value">DataSection_multivars</A><BR>
    1314      <A CLASS="lc" HREF="field_stats.html" TARGET="value">field_stats</A><BR>
    1415      <A CLASS="lc" HREF="lonlat_polygon.html" TARGET="value">lonlat_polygon</A><BR>
    1516      <A CLASS="lc" HREF="maskvar.html" TARGET="value">maskvar</A><BR>
    1617      <A CLASS="lc" HREF="setvar_asciivalues.html" TARGET="value">setvar_asciivalues</A><BR>
    17       <A CLASS="lc" HREF="varaddattr.html" TARGET="value">varaddattr</A><BR>
    18       <A CLASS="lc" HREF="varaddattrk.html" TARGET="value">varaddatrk</A><BR>
     18      <A CLASS="lc" HREF="addvarattr.html" TARGET="value">varaddattr</A><BR>
     19      <A CLASS="lc" HREF="addvarattrk.html" TARGET="value">varaddatrk</A><BR>
    1920    </DIV>
    2021    <DIV CLASS="valmenu">
  • trunk/tools/nc_var_tools.py

    r1493 r1499  
    169169errormsg = 'ERROR -- error -- ERROR -- error'
    170170warnmsg = 'WARNING -- warning -- WARNING -- warning'
     171infmsg = 'INFORMATION -- information -- INFORMATION -- information'
    171172
    172173## Constants
     
    1380613807      vn= variable name to include
    1380713808      sliced= dictionary with the dimension name as key and [beg, end, int] as values
     13809        if beg=-9, means that values for the dimension corresponds for a series of individual values
    1380813810    """
    1380913811    fname = 'put_variable_slice'
     
    1381913821    dnvs = []
    1382013822    varslice = []
     13823
     13824    # Dictionary with the size of the sliced dimensions
     13825    newdimsizes = {}
    1382113826# Getting variable's dimensions
     13827    Nslices = 1
    1382213828    for dnv in ov.dimensions:
    1382313829        if gen.searchInlist(sliced.keys(),dnv):
    13824             newdimsize = sliced[dnv][1] - sliced[dnv][0]
    13825         else:
    13826             newdimsize = 10
     13830            if sliced[dnv][0] == -9:
     13831                newdimsize = len(sliced[dnv])-1
     13832                Nslices = newdimsize
     13833            else:
     13834                if sliced[dnv][2] != 0:
     13835                    newdimsize = len(range(sliced[dnv][0], sliced[dnv][1],           \
     13836                      sliced[dnv][2]))
     13837                else:
     13838                    newdimsize = 0
     13839            newdimsizes[dnv] = newdimsize
     13840            # Creation of dimensions according to the slice
     13841            if not gen.searchInlist(onc.dimensions, dnv):
     13842                od = inc.dimensions[dnv]
     13843                if od.isunlimited():
     13844                    newdim = onc.createDimension(dnv, None)
     13845                else:
     13846                    if newdimsize > 0: newdim = onc.createDimension(dnv, newdimsize)
    1382713847        if not gen.searchInlist(onc.dimensions,dnv):
    13828 # Avoiding montone dimensions!
     13848# Avoiding monotone dimensions!
    1382913849            if newdimsize > 0:
    1383013850                od = inc.dimensions[dnv]
     
    1383413854                    dsize = len(od)
    1383513855                newdim = onc.createDimension(dnv, dsize)
    13836         if gen.searchInlist(sliced.keys(),dnv):
    13837             if newdimsize > 0:
    13838                 varslice.append(slice(sliced[dnv][0], sliced[dnv][1], sliced[dnv][2]))
    13839                 dnvs.append(dnv)
    13840             else:
    13841                 varslice.append(sliced[dnv][0])
    13842         else:
    13843             varslice.append(slice(0,len(inc.dimensions[dnv])))
    13844             dnvs.append(dnv)
    13845 # Getting variable
     13856            newdimsizes[dnv] = newdimsize
     13857
     13858    # Getting variable
    1384613859    varattrs = ov.ncattrs()
    1384713860    if gen.searchInlist(varattrs, '_FillValue'):
     
    1385113864    vartype = ov.dtype
    1385213865
    13853     newvar = onc.createVariable(vn, vartype, tuple(dnvs), fill_value=varfil)
    13854     finalvals = np.squeeze(ov[tuple(varslice)])
    13855     newvar[:] = finalvals
     13866    # List of slices
     13867    for idind in range(Nslices):
     13868        newvarslice = []
     13869        for dnv in ov.dimensions:
     13870            if gen.searchInlist(sliced.keys(),dnv):
     13871                if sliced[dnv][0] != -9:
     13872                    if newdimsizes[dnv] > 0:
     13873                        varslice.append(slice(sliced[dnv][0], sliced[dnv][1],        \
     13874                          sliced[dnv][2]))
     13875                        dnvs.append(dnv)
     13876                        newvarslice.append(slice(sliced[dnv][0], sliced[dnv][1],     \
     13877                          sliced[dnv][2]))
     13878                    else:
     13879                        varslice.append(sliced[dnv][0])
     13880                else:
     13881                    varslice.append(sliced[dnv][idind])
     13882                    newvarslice.append(idind)
     13883            else:
     13884                varslice.append(slice(0,len(inc.dimensions[dnv])))
     13885                dnvs.append(dnv)
     13886                newvarslice.append(slice(0,len(inc.dimensions[dnv])))
     13887
     13888        if idind == 0:
     13889            newvar = onc.createVariable(vn, vartype, tuple(dnvs), fill_value=varfil)
     13890 
     13891        finalvals = np.squeeze(ov[tuple(varslice)])
     13892        newvar[tuple(newvarslice)] = finalvals
    1385613893
    1385713894    for attrs in varattrs:
     
    1386513902    """ Function to get a section (values along multiple variables) of a given data-set
    1386613903      values= [varn1],[beg1],[end1],[int1]@[...[[varnM],[begM],[endM],[intM]]]
    13867         [varni]: name of the variable ('WRFtime', for WRF time varibale)
     13904        [varni]: name of the variable with exception of:
     13905          'dist;[var1],[val1]|[...,[varN],val2]] distance computed from sqrt[sum_i([vari]-[vali])^2)]
     13906             variables have to be of the same shape and share dimensions
    1386813907        [begi],[endi],[inti]: beginning, end and interval along the variable
    1386913908          [endi] = -1, maximum value
    13870           [inti] = -1, all the values within the range
     13909          [inti] = -1, all the values within the range (default)
    1387113910                 = 0, single value. [begi] will be taken as the reference value
    1387213911          NOTE: variables without section by the variables are taken allover their size
    1387313912          NOTE2: if inti = 'str', it is assumed that the variable is a string-list of values
    13874             then [begi] must be the string to be used ('!', for spaces)
     13913            then [begi] must be the string to be used for the search ('!', for spaces)
    1387513914      filen= netCDF with the data-set
    1387613915      varn= ',' list of variables ('all', for all variables)
    1387713916    """
     13917# Not working          'WRFtime', for WRF time varibale
     13918
    1387813919    import numpy.ma as ma
    1387913920    fname = 'DataSetSection_multivars'
    1388013921
    1388113922# Variables not to check in the file
    13882     NOcheck = ['WRFtime']
     13923    NOcheck = ['WRFtime','dist']
    1388313924
    1388413925    if values == 'h':
     
    1390413945    fintvs = np.zeros((Nvars), dtype=np.float)
    1390513946
     13947    # Dictionary with the indices with coincident values
     13948    dimvals = {}
     13949
    1390613950    for ivar in range(Nvars):
    1390713951        val = values.split('@')[ivar]
    1390813952        vn = val.split(',')[0]
    13909         if not gen.searchInlist(nciobj.variables,vn):
     13953        if not gen.searchInlist(nciobj.variables,vn) and                             \
     13954          not gen.searchInlist(NOcheck,vn) and vn[0:4] != 'dist':
    1391013955            print errormsg
    1391113956            print '  ' + fname + ": file '" + filen + "' does not have variable '" + \
     
    1391313958            print '    it has:', list(nciobj.variables)
    1391413959            quit(-1)
    13915 
    13916         ostrvar = nciobj.variables[vn]
    13917         varns.append(vn)
    13918         if val.split(',')[3] == 'str':
    13919             strvalue = val.split(',')[1].replace('!',' ')
     13960        if val[0:4] == 'dist':
     13961            # Selection by distance
     13962            varns.append('dist')
     13963            vardist = val.split(';')[1].split('|')
     13964            varsdist = {}
     13965            iiv = 0
     13966            distv = 0.
     13967            # Computing distance and looking for the minimal distance
     13968            for vdn in vardist:
     13969                dvarn = vdn.split(',')[0]
     13970                dvalS = vdn.split(',')[1]
     13971                if not gen.searchInlist(nciobj.variables,dvarn):
     13972                    print errormsg
     13973                    print '  '+fname+": file '"+filen+"' does not have variable '" + \
     13974                      dvarn + "' !!"
     13975                    print '    it has:', list(nciobj.variables)
     13976                    quit(-1)
     13977                oval = nciobj.variables[dvarn]
     13978                Vvals = oval[:]
     13979                dval = gen.retype(dvalS,oval.dtype)
     13980
     13981                if iiv == 0:
     13982                    valsfirst = Vvals
     13983                    valsdims = oval.dimensions
     13984                    if dvalS[0:1] == '-':
     13985                        LdvalS = len(dvalS)
     13986                        distS = '('+ dvarn + '+' + dvalS[1:LdvalS+1] + ')^2'
     13987                    else:
     13988                        distS = '('+ dvarn + '-' + dvalS + ')^2'
     13989                    distv = (Vvals - dval)**2
     13990                else:
     13991                    # Checking for consistency among
     13992                    gen.same_shape(valsfirst, Vvals)
     13993                    if dvalS[0:1] == '-':
     13994                        LdvalS = len(dvalS)
     13995                        distS = distS + ' + ('+ dvarn + '+' + dvalS[1:LdvalS+1] + ')^2'
     13996                    else:
     13997                        distS = distS + ' + ('+ dvarn + '-' + dvalS + ')^2'
     13998
     13999                    distv = distv + (Vvals - dval)**2
     14000                iiv = iiv + 1
     14001            mindist = np.min(distv)
     14002            iDistmindist = gen.multi_index_mat(distv, mindist)
     14003
     14004            print infmsg
     14005            print '  ' + fname + ": found a distance searching as dist=sqrt(" +      \
     14006              distS + ")"
     14007            varsdist[dvarn] = dval
     14008            print '    found:', len(iDistmindist),'values at distance:', mindist
     14009            iid = 0
     14010            for dimn in valsdims:
     14011                dvvs = []
     14012                for ifound in range(len(iDistmindist)):
     14013                    foundvals = iDistmindist[ifound]
     14014                    if len(dvvs) == 0: dvvs = [int(foundvals[iid])]
     14015                    # getting indices for a given dimension including non-repeated
     14016                    if not gen.searchInlist(dvvs, foundvals[iid]):
     14017                        dvvs.append(int(foundvals[iid]))
     14018                iid = iid + 1
     14019                # Including only that indices coincident with previous founds
     14020                if dimvals.has_key(dimn):
     14021                    foundvals = dimvals[dimn]
     14022                    coincvals = list(set(foundvals).intersection(set(dvvs)))
     14023                    if len(coincvals) == 0:
     14024                        print errormsg
     14025                        print '  ' + fname + ': no coincidencies among searches ' + \
     14026                          "found for dimension '" + dimn + "' !!"
     14027                        print '    revise criteria of selection of values'
     14028                        quit(-1)
     14029                    else:
     14030                        dimvals[dimn] = coincvals
     14031                else:
     14032                    dimvals[dimn] = dvvs
     14033             
     14034        elif val.split(',')[3] == 'str':
     14035            # String search
     14036            ostrvar = nciobj.variables[vn]
     14037            ostrvardims = ostrvar.dimensions
     14038            varns.append(vn)
     14039            istrvalue = val.split(',')[1].replace('!',' ')
     14040            estrvalue = val.split(',')[2].replace('!',' ')
    1392014041            print warnmsg
    1392114042            print '  ' + fname + ": String value for variable '" + val + "' !!"
    1392214043            print '    assuming string variable as [Nvalues, Lstring]'
    13923             print "    from which only is required '" + strvalue + "'"
     14044            if istrvalue != estrvalue:
     14045                print "    from which is required from '" + istrvalue + "' to '" +   \
     14046                  estrvalue + "'"
     14047            else:
     14048                print "    from which only is required '" + istrvalue + "'"
    1392414049            strvals = get_str_nc(ostrvar, ostrvar.shape[1])
    13925             if not gen.searchInlist(strvals, strvalue):
     14050            if not gen.searchInlist(strvals, istrvalue):
    1392614051                print errormsg
    1392714052                print '  ' + fname + ": variable '" + val + "' does not have " +     \
    13928                   "value= '" + strvalue + "' !!"
     14053                  "value= '" + istrvalue + "' !!"
    1392914054                print '    values:', strvals
    1393014055                quit(-1)
    13931             indstrvalue = strvals.index(strvalue)
     14056            if istrvalue != estrvalue:
     14057                if not gen.searchInlist(strvals, estrvalue):
     14058                    print errormsg
     14059                    print '  ' + fname + ": variable '" + val + "' does not have " + \
     14060                      "value= '" + estrvalue + "' !!"
     14061                    print '    values:', strvals
     14062                    quit(-1)
     14063
     14064            dimvals[ostrvardims[1]] = range(ostrvar.shape[1])
     14065            dimn = ostrvardims[0]
     14066            if istrvalue == estrvalue:
     14067                Nfound = strvals.count(istrvalue)
     14068                print infmsg
     14069                print '  '+fname+ ": variable '" + vn + "' has:", Nfound, "times " + \
     14070                  "value '" + istrvalue + "'"
     14071
     14072                # Values found for each dimension
     14073
     14074                # Assuming shape as said
     14075                copyvals = list(strvals)     
     14076                dvvs = []
     14077                for iif in range(Nfound):
     14078                    iidstr = copyvals.index(strvalue)
     14079                    dvvs.append(iidstr+iif)
     14080                    copyvals.pop(iidstr)
     14081            else:
     14082                ibeg = strvals.index(istrvalue)
     14083                iend = strvals.index(estrvalue)
     14084                dvvs = range(ibeg,iend)
     14085
     14086            # Including only that indices coincident with previous founds
     14087            if dimvals.has_key(dimn):
     14088                foundvals = dimvals[dimn]
     14089                coincvals = list(set(foundvals).intersection(set(dvvs)))
     14090                if len(coincvals) == 0:
     14091                    print errormsg
     14092                    print '  ' + fname + ': no coincidencies among searches found '+ \
     14093                      "for dimension '" + dimn + "' !!"
     14094                    print '    revise criteria of selection of values'
     14095                    quit(-1)
     14096                else:
     14097                    dimvals[dimn] = coincvals
     14098
     14099            indstrvalue = strvals.index(istrvalue)
     14100            endstrvalue = strvals.index(estrvalue)
    1393214101            begvs[ivar] = np.float(indstrvalue)
    1393314102            endvs[ivar] = np.float(indstrvalue)
    1393414103            intvs[ivar] = -99.
    1393514104        else:
    13936             begvs[ivar] = np.float(val.split(',')[1])
    13937             endvs[ivar] = np.float(val.split(',')[2])
    13938             intvs[ivar] = np.float(val.split(',')[3])
     14105            # Range search
     14106            ovar = nciobj.variables[vn]
     14107            vals = ovar[:]
     14108            valsdims = ovar.dimensions
     14109            varns.append(vn)
     14110            begvs[ivar] = gen.retype(val.split(',')[1], ovar.dtype)
     14111            endvs[ivar] = gen.retype(val.split(',')[2], ovar.dtype)
     14112            intvs[ivar] = -1
    1393914113            fbegvs[ivar] = np.float(val.split(',')[1])
    1394014114            fendvs[ivar] = np.float(val.split(',')[2])
    1394114115            fintvs[ivar] = np.float(val.split(',')[3])
     14116
     14117            if endvs[ivar] == -1: endvs[ivar] = np.max(vals)
     14118            maskinf = ma.masked_less(vals, begvs[ivar])
     14119            masksup = ma.masked_greater(vals, endvs[ivar])
     14120
     14121            #if intvs[ivar] != -1:
     14122            #    print errormsg
     14123            #    print '  ' + fname + ': non-consecutive slices not ready!!'
     14124            #    quit(-1)
     14125            finalmask = maskinf.mask + masksup.mask
     14126            print 'Lluis: found;', np.sum(~finalmask)
     14127            # Indices of the found values
     14128            iDistmindist = gen.multi_index_mat(finalmask, False)
     14129
     14130            print '    found:', len(iDistmindist),"values in variable '" + vn +      \
     14131              "' as; beginning:", begvs[ivar], 'ending:', endvs[ivar], 'interval:',  \
     14132              intvs[ivar]
     14133            iid = 0
     14134            for dimn in valsdims:
     14135                dvvs = []
     14136                for ifound in range(len(iDistmindist)):
     14137                    foundvals = iDistmindist[ifound]
     14138                    # getting indices for a given dimension
     14139                    dvvs.append(int(foundvals[iid]))
     14140                iid = iid + 1
     14141                # Including only that indices coincident with previous founds
     14142                if dimvals.has_key(dimn):
     14143                    foundvals = dimvals[dimn]
     14144                    coincvals = list(set(foundvals).intersection(set(dvvs)))
     14145                    if len(coincvals) == 0:
     14146                        print errormsg
     14147                        print '  ' + fname + ': no coincidencies among searches ' + \
     14148                          "found for dimension '" + dimn + "' !!"
     14149                        print '    revise criteria of selection of values'
     14150                        quit(-1)
     14151                    else:
     14152                        dimvals[dimn] = coincvals
     14153                else:
     14154                    dimvals[dimn] = dvvs
     14155
    1394214156            if intvs[ivar] != -1:
    1394314157                slicevalS = slicevalS + varns[ivar] + ' (' + str(fbegvs[ivar]) + ',' +   \
     
    1394714161                  str(fendvs[ivar]) + ',1); '
    1394814162
     14163    print infmsg
     14164    print '  ' + fname + ': Indices found for each dimensions ____'
     14165    finalslice = {}
     14166    for dimn in dimvals.keys():
     14167        ddvals = dimvals[dimn]
     14168        print '    ' + dimn + ':', ddvals
     14169        if len(dimvals[dimn]) > 1:
     14170            Lddvals = len(ddvals)
     14171            if np.all(np.array(ddvals[1:Lddvals])-np.array(ddvals[0:Lddvals-1])) == 1:
     14172                finalslice[dimn] = [ddvals[0], ddvals[Lddvals-1], 1]
     14173            else:
     14174                finalslice[dimn] = [-9] + ddvals
     14175        else:
     14176            finalslice[dimn] = [ddvals[0], ddvals[0], 0]
     14177
     14178    print 'Lluis finalslice:', finalslice
     14179
    1394914180    ncoobj = NetCDFFile(ofile,'w')
    13950 
    1395114181# Output variables
    1395214182##
     
    1395914189            variables = [varn]
    1396014190
    13961 # Looking for limits due to the variables
    13962 ##
    13963     slicedims = {}
    13964     for ivar in range(Nvars):
    13965         print '  ' + fname + ": masking with '" + varns[ivar] + "':",  begvs[ivar],  \
    13966           ',', endvs[ivar], ',', intvs[ivar]
    13967         if not gen.searchInlist(nciobj.variables,varns[ivar]) and not                \
    13968           gen.searchInlist(NOcheck,varns[ivar]):
     14191    for varn in variables:
     14192        if not gen.searchInlist(nciobj.variables, varn):
    1396914193            print errormsg
    13970             print ' ' + fname + ": variable '" + varns[ivar] + "' is not in ' +      \
    13971               'input file!!"
     14194            print '  ' + fname + ": file '" + filen + "' does not have variable '" + \
     14195              dvarn + "' !!"
     14196            print '    it has:', list(nciobj.variables)
    1397214197            quit(-1)
    1397314198
    13974         if varns[ivar] == 'WRFtime':
    13975             ovar = nciobj.variables['Times'][:]
    13976             vals = []
    13977             for it in range(ovar.shape[0]):
    13978                 vals.append(datetimeStr_conversion(ovar[it,:], 'WRFdatetime',        \
    13979                   'YmdHMS'))
    13980                 vals[it] = int(vals[it])
    13981                 begvs[ivar] = int(begvs[ivar])
    13982                 endvs[ivar] = int(endvs[ivar])
    13983                 intvs[ivar] = int(intvs[ivar])
    13984 
    13985             vals = np.array(vals)
    13986             vardims = ['Time']
    13987         else:
    13988             ovar = nciobj.variables[varns[ivar]]
    13989             vals = ovar[:]
    13990             vardims = ovar.dimensions
    13991 
    13992         if intvs[ivar] == -99.:
    13993             ostrvar = nciobj.variables[varns[ivar]]
    13994             finalmask = np.ones((ostrvar.shape), dtype= bool)
    13995             finalmask[int(begvs[ivar]),:] = False
    13996         elif intvs[ivar] == 0.:
    13997 #           Looking in the non efficient way
    13998             diffvar = np.abs(vals-fbegvs[ivar])
    13999             mindiffvar = np.min(diffvar)
    14000             imindiff = gen.index_mat(diffvar, mindiffvar)
    14001             if np.all(imindiff == -1):
    14002                 print errmsg
    14003                 print '  ' + fname + ": no exact value '" + varns[ivar] + "'=",      \
    14004                   fbegvs[ivar], 'has been found!!'
    14005                 quit(-1)
    14006             print '  ' + fname + ": '" + varns[ivar] + "'= ", fbegvs[ivar],          \
    14007               'indexes:', imindiff, 'distance:', mindiffvar
    14008             finalmask = np.ones(vals.shape, dtype=np.float)
    14009            
    14010             finalmask[tuple(imindiff)] = False
    14011         else:
    14012             if endvs[ivar] == -1: endvs[ivar] = np.max(vals)
    14013             maskinf = ma.masked_less(vals, begvs[ivar])
    14014             masksup = ma.masked_greater(vals, endvs[ivar])
    14015 
    14016             if intvs[ivar] != -1:
    14017                 print errormsg
    14018                 print '  ' + fname + ': non-consecutive slices not ready!!'
    14019                 quit(-1)
    14020             finalmask = maskinf.mask + masksup.mask
    14021             idn = 0
    14022        
    14023         iidim = 0
    14024         for dn in vardims:
    14025             ddn = len(nciobj.dimensions[dn])
    14026             dinds = np.arange(ddn)
    14027             rightvals = ~ma.array(vals, mask=finalmask).mask
    14028 
    14029 # Checking if dimension is already cut:
    14030             if slicedims.has_key(dn):
    14031                 slicedval = slicedims[dn]
    14032                 if slicedval[0] == 0 and slicedval[1] == ddn:
    14033                     fulldim = True
    14034                 else:
    14035                     fulldim = False
    14036             else:
    14037                 fulldim = True
    14038 
    14039             if not slicedims.has_key(dn) or fulldim:
    14040                 if intvs[ivar] == -99.:
    14041                     if iidim == 0:
    14042                         slicedims[dn]=[int(begvs[ivar]), int(begvs[ivar]), None]
    14043                     else:
    14044                         slicedims[dn]=[0, ddn, None]
    14045                 elif intvs[ivar] == 0.:
    14046                     if imindiff[iidim] == 0:
    14047                         slicedims[dn]=[0, ddn, None]
    14048                     else:
    14049                         slicedims[dn]=[imindiff[iidim], imindiff[iidim], None]
    14050                 else:
    14051                     slicedims[dn]=[np.min(dinds), np.max(dinds)+1, None]
    14052 
    14053             iidim = iidim + 1
    14054 
    14055         print '  ' + fname + ': slicing variables with______'
    14056         print slicedims
    14057  
    14058 # Creating dimensions
    14059 ##
    14060     print '  ' + fname + ': adding dimensions...'
    14061     for nd in slicedims.keys():
    14062         objdim = nciobj.dimensions[nd]
    14063         if objdim.isunlimited():
    14064             dimsize = None
    14065         else:
    14066             dimsize = slicedims[nd][1] - slicedims[nd][0]
    14067         if dimsize > 0: newdim = ncoobj.createDimension(nd, dimsize)
    14068     ncoobj.sync()
    14069 
    14070     for var in variables:
    14071         put_variable_slice(nciobj, ncoobj, var, slicedims)
     14199        ovar = nciobj.variables[varn]
     14200        vardims = ovar.dimensions
     14201
     14202        put_variable_slice(nciobj, ncoobj, varn, finalslice)
    1407214203
    1407314204# Global attributes
     
    1407814209
    1407914210    attr = set_attribute(ncoobj, 'sliced_variables', slicevalS)
     14211    add_global_PyNCplot(ncoobj, main, fname, '1.1')
    1408014212
    1408114213    nciobj.close()
Note: See TracChangeset for help on using the changeset viewer.