- Timestamp:
- 21/11/04 14:27:52 (16 years ago)
- Location:
- nappy/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
nappy/trunk/cdms2na.py
r349 r351 1 1 #!/usr/bin/env python 2 # 3 # 4 # 2 # Copyright (C) 2004 CCLRC & NERC( Natural Environment Research Council ). 3 # This software may be distributed under the terms of the 4 # Q Public License, version 1.0 or later. http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 5 5 6 6 helpMessage=""" … … 27 27 # Imports from python standard library 28 28 import sys, os, time, string, fileinput, re 29 sys.path.append("..") 29 if len(sys.argv)>0: 30 sys.path.append(os.path.join("..", "..")) 31 sys.path.append("..") 30 32 31 33 # Import cdat modules … … 117 119 if hasattr(var, "long_name"): name=var.long_name 118 120 if hasattr(var, "standard_name"): name=var.standard_name 119 if hasattr(var, "units") and not re.match("^\s+$", var.units): name="%s (%s)" % (name, var.units) 120 # Do a check to see units are not duplicated 121 match=re.match("(.*\(%s\)\s*)\(%s\)(.*)$" % (var.units, var.units), name) 122 if match: 123 name=match.groups()[0]+match.groups()[1] 121 if hasattr(var, "units") and not re.match("^\s+$", var.units): 122 name="%s (%s)" % (name, var.units) 123 # Do a check to see units are not duplicated 124 match=re.match("(.*\(%s\)\s*)\(%s\)(.*)$" % (var.units, var.units), name) 125 if match: 126 name=match.groups()[0]+match.groups()[1] 124 127 125 128 if name[-2:]=="()": name=name[:-2] … … 250 253 else: 251 254 self.naDict["FFI"]=1001 252 print self.naDict["FFI"]255 #print self.naDict["FFI"] 253 256 axes=bestVar.getAxisList() 254 257 255 258 # Get other variable info 256 for var in self.vars[:bestVarIndex ]+self.vars[bestVarIndex:]:259 for var in self.vars[:bestVarIndex-1]+self.vars[bestVarIndex:]: 257 260 if len(var.shape)!=ndims or var.shape!=shape: 258 261 # Could it be an auxiliary variable … … 486 489 487 490 if len(self.extra_comments[2])>0: 488 for excom in extra_comments[2]:491 for excom in self.extra_comments[2]: 489 492 NCOM.append(excom) 490 493 -
nappy/trunk/naToCdms.py
r349 r351 242 242 axis.units=self.time_units 243 243 axis.long_name=axis.name="time (%s)" % self.time_units 244 244 if axis.units==None: 245 if units: 246 axis.units=units 247 else: 248 axis.units="Not known" 245 249 return axis 246 250
Note: See TracChangeset
for help on using the changeset viewer.