- Timestamp:
- Jan 18, 2016, 4:37:28 PM (9 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var.py
r666 r674 133 133 ncvar.DataSetSection(opts.values, opts.ncfile) 134 134 elif oper == 'DataSetSection_multidims': 135 ncvar.DataSetSection_multidims(opts.values, opts.ncfile )135 ncvar.DataSetSection_multidims(opts.values, opts.ncfile, opts.varname) 136 136 elif oper == 'DataSetSection_multivars': 137 137 ncvar.DataSetSection_multivars(opts.values, opts.ncfile, opts.varname) -
trunk/tools/nc_var_tools.py
r672 r674 8766 8766 return 8767 8767 8768 def DataSetSection_multidims(values, filen ):8768 def DataSetSection_multidims(values, filen, varn): 8769 8769 """ Function to get a section (values along multiple dimensions) of a given data-set 8770 8770 values= [dimn1],[beg1],[end1],[int1]@[...[[dimnM],[begM],[endM],[intM]]] … … 8774 8774 NOTE: dimensions without values are taken allover their size 8775 8775 filen= netCDF with the data-set 8776 DataSetSection_multidims('Time,-1,-1,1@bottom_top,6,6,1','wrfout_d01_1979-12-01_00:00:00') 8776 varn= ',' list of variables, 'all' for all variables in data-set 8777 DataSetSection_multidims('Time,-1,-1,1@bottom_top,6,6,1','wrfout_d01_1979-12-01_00:00:00','all') 8777 8778 """ 8778 8779 fname = 'DataSetSection_multidims' … … 8835 8836 8836 8837 if begvs[dimid] != endvs[dimid]: 8837 dimsize = (endvs[dimid]-begvs[dimid]+1)/intvs[dimid] 8838 dimslices[dims] = [begvs[dimid],endvs[dimid]+1,intvs[dimid]] 8838 if endvs[dimid] != -1: 8839 dimsize = (endvs[dimid]-begvs[dimid]+1)/intvs[dimid] 8840 dimslices[dims] = [begvs[dimid],endvs[dimid]+1,intvs[dimid]] 8841 else: 8842 print 'here!' 8843 dimsize = len(objdim) 8844 dimslices[dims] = [begvs[dimid],len(objdim),1] 8839 8845 else: 8840 8846 dimsize = 1 … … 8856 8862 ## 8857 8863 print ' ' + fname + ': adding variables...' 8858 for varns in nciobj.variables: 8859 # print ' ' + fname + ': adding variable "' + varns + '"...' 8864 if varn == 'all': 8865 getvarns = nciobj.variables 8866 else: 8867 getvarns = varn.split(',') 8868 8869 for varns in getvarns: 8870 print ' ' + fname + ': adding variable "' + varns + '"...' 8860 8871 varobj = nciobj.variables[varns] 8861 8872
Note: See TracChangeset
for help on using the changeset viewer.