Changeset 1082 for trunk/UTIL
- Timestamp:
- Oct 28, 2013, 5:28:40 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/planetoplot_v2/ppclass.py
r1069 r1082 50 50 print "**** INSPECT FILE",filename 51 51 test = netCDF4.Dataset(filename) 52 #for obj in test.dimensions.values(): print obj 52 53 print "**** VARIABLES: ",test.variables.keys() 53 for dim in test.dimensions.keys(): 54 output = "**** DIMENSION: "+str(dim)+" "+str(len(test.dimensions[dim])) 55 try: output = output + " ----> "+str(test.variables[dim][0])+" "+str(test.variables[dim][-1]) 56 except: pass 57 print output ; output = "" 54 findinlist(test,glob_listx,"**** FOUND X-AXIS ---> ") 55 findinlist(test,glob_listy,"**** FOUND Y-AXIS ---> ") 56 findinlist(test,glob_listz,"**** FOUND Z-AXIS ---> ") 57 findinlist(test,glob_listt,"**** FOUND T-AXIS ---> ") 58 print "**** ( according to settings in "+whereset+zefile+" )" 59 # -- function defined for the above function inspect 60 def findinlist(netcdfobj,extlist,message): 61 found = False 62 for c in extlist: 63 if c in netcdfobj.variables.keys(): 64 found = True 65 output = message+str(c) 66 if c in netcdfobj.dimensions.keys(): 67 output = output+" ---- has "+str(len(netcdfobj.dimensions[c]))+" values" 68 try: output = output + " ---- from "+str(netcdfobj.variables[c][0])+" to "+str(netcdfobj.variables[c][-1]) 69 except: pass 70 print output ; output = "" 71 if not found: 72 print message+"not found. will simply use index." 58 73 59 74 # request a given attribute (and test if it is here)
Note: See TracChangeset
for help on using the changeset viewer.