Changeset 348
- Timestamp:
- 15/11/04 14:27:32 (16 years ago)
- Location:
- nappy/trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
nappy/trunk/data_files/00README.txt
r339 r348 1 All files in this data_files directory were taken from the BADC web site examples at: 1 # Copyright (C) 2004 NERC DataGrid 2 # This software may be distributed under the terms of the 3 # Q Public License, version 1.0 or later. http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 4 5 6 7 Files in this data_files directory were taken from the BADC web site examples at: 2 8 3 9 http://badc.nerc.ac.uk/help/formats/NASA-Ames/ 10 11 or from "Format Specification for Data Exchange, Version 1.3 (Gaines and Hipskind, 1998)" a copy of which is at:- 12 13 http://badc.nerc.ac.uk/help/formats/NASA-Ames/G-and-H-June-1998.html -
nappy/trunk/naFile.py
r347 r348 7 7 8 8 """ 9 # Copyright (C) 2004 NERC DataGrid 10 # This software may be distributed under the terms of the 11 # Q Public License, version 1.0 or later. http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 12 13 # 08/05/04 updated by selatham for bug fixes and new write methods 9 14 10 15 # Imports from python standard library … … 175 180 Writes the auxiliary variables section of the header. 176 181 Assumes we are at the right point in the file. 177 """ 182 """ 178 183 self.file.write("%s\n" % self.NAUXV) 179 184 if self.NAUXV>0: 180 185 self.file.write(("%s "*self.NAUXV+"\n") % tuple(self.ASCAL)) 181 186 self.file.write(("%s "*self.NAUXV+"\n") % tuple(self.AMISS)) 182 self.file.write("%s\n"*self.N V % tuple(self.ANAME))187 self.file.write("%s\n"*self.NAUXV % tuple(self.ANAME)) #08/11/04 selatham 183 188 184 189 def _readCharAuxVariablesHeaderSection(self): -
nappy/trunk/naFile1010.py
r347 r348 6 6 7 7 """ 8 # Copyright (C) 2004 NERC DataGrid 9 # This software may be distributed under the terms of the 10 # Q Public License, version 1.0 or later. http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 11 12 # 08/05/04 updated by selatham for bug fixes and new write methods 8 13 9 14 # Imports from python standard library … … 29 34 self._readAuxVariablesHeaderSection() 30 35 self._readComments() 36 37 def writeHeader(self): #08/05/04 selatham 38 """ #08/05/04 selatham 39 Writes FFI-specifc header section. #08/05/04 selatham 40 """ #08/05/04 selatham 41 self._writeCommonHeader() #08/05/04 selatham 42 self.file.write(("%s "*self.NIV+"\n") % tuple(self.DX)) #08/05/04 selatham 43 self.file.write("%s\n"*self.NIV % tuple(self.XNAME)) #08/05/04 selatham 44 self._writeVariablesHeaderSection() #08/05/04 selatham 45 self._writeAuxVariablesHeaderSection() #08/05/04 selatham 46 self._writeComments() #08/05/04 selatham 31 47 32 48 def _setupArrays(self): … … 62 78 # Now get the dependent variables 63 79 (v, rtlines)=readItemsFromUnknownLines(datalines, self.NV, float) 64 # Set up mth list in self.V 65 self.V.append([])80 # Set up mth list in self.V #08/05/04 selatham 81 # self.V.append([]) #08/05/04 selatham 66 82 count=0 67 83 for n in range(self.NV): 68 self.V[n].append([]) 69 self.V[ivar_count].append(v[count]) 84 #self.V[n].append([]) #08/05/04 selatham 85 #self.V[ivar_count].append(v[count]) #08/05/04 selatham 86 self.V[n].append(v[count]) #08/05/04 selatham 70 87 count=count+1 71 88 return rtlines 89 90 def writeData(self): #08/05/04 selatham 91 """ #08/05/04 selatham 92 Writes the data section of the file. #08/05/04 selatham 93 This method can be called directly by the user. #08/05/04 selatham 94 """ #08/05/04 selatham 95 for m in range(len(self.X)): #08/05/04 selatham 96 # Write Independent variable mark and auxiliary variables #08/05/04 selatham 97 var_string="%s " % self.X[m] #08/05/04 selatham 98 for a in range(self.NAUXV): #08/05/04 selatham 99 var_string=var_string+("%s " % self.A[a][m]) #08/05/04 selatham 100 self.file.write("%s\n" % var_string.rstrip()) #08/05/04 selatham 101 # Write dependant variables #08/05/04 selatham 102 var_string="" #08/05/04 selatham 103 for n in range(self.NV): #08/05/04 selatham 104 var_string=var_string+("%s " %self.V[n][m]) #08/05/04 selatham 105 self.file.write("%s \n" %var_string) #08/05/04 selatham -
nappy/trunk/naFile1020.py
r347 r348 6 6 7 7 """ 8 # Copyright (C) 2004 NERC DataGrid 9 # This software may be distributed under the terms of the 10 # Q Public License, version 1.0 or later. http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 11 12 # 08/05/04 updated by selatham for bug fixes and new write methods 8 13 9 14 # Imports from python standard library … … 60 65 self.X[0]=newX 61 66 self._normalizedX="yes" 67 68 def writeData(self): #08/11/04 selatham 69 """ #08/11/04 selatham 70 Writes the data section of the file. #08/11/04 selatham 71 This method can be called directly by the user. #08/11/04 selatham 72 """ #08/11/04 selatham 73 for m in range(len(self.X)): #08/11/04 selatham 74 # Write Independent variable mark and auxiliary variables #08/11/04 selatham 75 var_string="%s " % self.X[m] #08/11/04 selatham 76 for a in range(self.NAUXV): #08/11/04 selatham 77 var_string=var_string+("%s " % self.A[a][m]) #08/11/04 selatham 78 self.file.write("%s\n" % var_string.rstrip()) #08/11/04 selatham 79 # Write dependant variablesf. #08/11/04 selatham 80 var_string="" #08/11/04 selatham 81 for n in range(self.NV): #08/11/04 selatham 82 var_string=var_string+("%s " %self.V[n][m]) #08/11/04 selatham 83 self.file.write("%s \n" %var_string) #08/11/04 selatham 84 -
nappy/trunk/test/testWrites.py
r347 r348 1 1 #!/usr/bin/env python 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 6 # 08/05/04 updated by selatham for bug fixes and new write methods 2 7 3 8 """ … … 13 18 import nappy ; reload(nappy) 14 19 15 for ffi in [1001, 2010, 3010, 4010]:20 for ffi in [1001, 1010, 2010, 3010, 4010]: #08/05/04 selatham 16 21 infile=os.path.join("..", "data_files", "%s.na" % ffi) 17 22 print "Reading in ", infile
Note: See TracChangeset
for help on using the changeset viewer.