Changeset 344


Ignore:
Timestamp:
15/06/04 13:46:45 (16 years ago)
Author:
astephen
Message:

* empty log message *

Location:
nappy/trunk
Files:
1 added
10 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • nappy/trunk/doc/00README.txt

    r339 r344  
    1 NASAAmesIO-0.3 
     1nappy 
     2===== 
     3 
     4NASA Ames Package in Python. 
     5 
     6Description: 
     7============ 
     8 
     9A NASA Ames IO package - A python input/output package for NASA Ames file formats 
     10 
     11 
     12Version history: 
     13================ 
     14 
     15Most recent version 
     16 
     17Version 0.9.7.2: Original - Ag Stephens, 14th May 2004. 
     18 
     19 
     20Planning Notes: 
     21=============== 
     22 
     23Software written with reference to: 
     24 
     25'Format Specification for Data Exchange' paper by Gaines and Hipkind (1998). 
     26makeheader.f fortran application to write NASA Ames headers, Anne de Rudder (2000). 
     27Ames python library developed by Bryan Lawrence (2003). 
     28 
     29Conventions: 
    230============== 
    331 
    4 Current status on Sunday 25th April 2004. 
     32The basic NASAAmes class holds a dictionary called naVars which holds all the  
     33variables described in the Gaines and Hipkind document and these are all named 
     34using CAPITAL LETTERS for compliance/reference with that document. 
    535 
    6 Most read classes now work. 
     36For example the number of independent variables is held in the instance variable: 
    737 
    8 Use the test/testReadNNNN.py scripts to try and read them. 
     38self["NIV"] 
     39 
     40Return values are being calculated for many functions/methods are often prefixed with 
     41'rt' symbolising 'return'. 
     42 
     43 
     44CDMS-link 
     45========= 
     46 
     47At the start, there are a number of formats that are not compatible with the CDMS format: 
     48 
     492110 - changing second independent variable length at each first independent variable value. 
     502160 - Character independent and auxiliary variables - would need a map to implement in CDMS so not intended. 
     512310 - changing second independent variable length at each first independent variable value. 
     52 
     53The following are unlikely, but can be done: 
     54 
     551020 - with NVPM (implied independent variable values) - we can allow it but low priority to implement. 
     56 
     57FFIs that need to be converted: 
     58 
     591001, 1010, 2010, 3010, 4010. 
     60 
     61The following have already been done: 
     62 
     631001, 2010, 3010, 4010. 
     64 
     65Current Status of the software 
     66============================== 
     67 
     68All read classes should now work. 
     69 
     70Use the test/testReadAllFFIs.py scripts to try and read them. 
    971 
    1072Note that the data sections may not be reading properly for some FFIs. 
    1173 
    12 The readData() methods are DEFINITELY not yet working for FFIs: 
    13 2110, 2160, 2310. 
     74The FFI classes for 2010, 3010 and 4010 all follow the same code exactly. 
    1475 
    15 The FFI classes for 2010, 3010 and 4010 all follow the same code exactly. 
     76Write classes should be working for: 1001, 2010, 3010 and 4010. 
     77 
     78You can test these using: 
     79 
     80test/testWrites.py 
     81 
     82You can write cdat output files to the following formats (i.e. any that you can write to from nappy): 
     83 
     841001, 2010, 3010, 4010. 
     85 
     86Test with: 
     87 
     88test/testCmdsWrite.py 
     89 
    1690 
    1791Reversing the independent variable marks 
     
    51125 
    52126 
    53 Things to do 
    54 ============ 
    55127 
    56 1. Complete the read data methods and check correct. 
     128Plans for improving nappy 
     129========================= 
    57130 
    58 2. Create simple write methods to match the read stuff. 
    59131 
    60 3. Create the following bridge to CDMS: 
     132•       Split the code into individual FFI files (naFile1001, naFile1010 etc). - Ag 
     133    ALL SPLIT AND READS APPEAR TO BE WORKING. 
     134•       Document code – Ag  - MAINLY DONE 
     135•       Write a NASA Ames compliance document by working through the Gaines and Hipkind guide and listing all the requirements of a file conforming to the NASA Ames standard – Wendy. 
     136•       Test all the input/output routines – Sue. 
     137•       Write additional output routines for FFI 1010, 1020, 2310, 2160, 2110. – Sue. 
     138•       Write a manual for the package - Ag 
     139•       Create a standard mapping file between cdat and nappy so that global attributes convert appropriately. This should be xml and should be a local table for various centres – Sue and Ag. 
     140•       Put the cdms stuff in the a class called NACdms and put that in cdmsTools/cdmsOut.py -> CdmsOut(). 
     141        NOT DONE DUE TO ANNOYING MULTIPLE RECURSIVE IMPORT DEPENDENCIES!!! 
     142•       Make the /bin directory and put the scripts in there called cdms2na.py, na2nc.py, also make nc2na.py that is just a pointer to cdms2na.py (just there to simplify things for dummies). 
    61143 
    62         self.toCdmsFile(filename, attribute_dictionary=None) - attribute  
    63                         dictionary can be extras if you want 
    64         self.varToCdmsVariable(variable) - you can send it a variable number 
    65                         or a variable name. 
    66         self.varToCdmsAxis(independentVariable) - you can send it an independent 
    67                         variable name or number. 
    68         self.auxVarToCdmsVariable(variable) - you can send it a name or number. 
     144- routines should not automatically read or write the DATA section. 
     145   DONE FOR READING, IS IT NEEDED FOR WRITING - you either write or you don't. 
     146- strip out _recursiveList operators so that they can be used elsewhere (and any other generic funcs) - maybe put in listManipulators.py 
     147    DONE TELL SUE. 
     148- Organise the underscores leading func names to be coherent. 
     149    DONE 
     150- Start including exceptions everywhere for checking. 
     151- history doesn't map properly from netcdf. 
     152- delimiters - let the user decide how to space items. 
     153- output formatting - let user decide eg %s, %4.3f etc 
    69154 
    70 4. Create the cdms2na.py script containing a functions called: 
    71         cdmsToNASAAmesFile(cdmsFile, naFile, nasaAmesAttributes={}) 
    72         cdmsVariableToNASAAmesFile(cdmsVariable, naFile, nasaAmesAttributes={}) 
    73155 
    74 Ag Stephens, 20 April 2004. 
     156 
     157 
  • nappy/trunk/test/testCdmsWrite.py

    r339 r344  
    1 import sys ; sys.path.append("..") 
    2 import naCore, textParser, naFile, general 
    3 reload(naCore) ; reload(textParser) ; reload(naFile) ; reload(general) 
     1import sys  
     2import os 
     3sys.path.append(os.path.join("..", "..")) 
     4import nappy ; reload(nappy) 
    45 
    56for ffi in [1001, 2010, 3010, 4010]: 
    67    print "Reading in NASA Ames 1001:" 
    7     x=general.openNAFile(r'../data_files/%s.na' % ffi) 
     8    infile=os.path.join("..", "data_files", "%s.na" % ffi) 
     9    x=nappy.openNAFile(infile) 
     10    x.readData() 
    811    print "Read file OK." 
    912 
    10     outfile="../output/out%s.nc" % ffi 
     13    outfile=os.path.join("..", "output", "out%s.nc" % ffi) 
    1114    print "Writing output NetCDF file %s" % outfile  
    1215    x.toCdmsFile(outfile) 
  • nappy/trunk/test/testReadAllFFIs.py

    r339 r344  
    99""" 
    1010 
     11import os 
     12import sys 
     13sys.path.append(os.path.join("..", "..")) 
     14import nappy ; reload(nappy) 
     15 
     16 
    1117FFIs=(1001, 1010, 1020, 2010, 2110, 2160, 2310, 3010, 4010) 
    1218 
    13 for FFI in FFIs: 
    14     print "Testing FFI: ", FFI 
    15     __import__("testRead%s" % FFI) 
     19for ffi in FFIs: 
     20    print "\n\nTesting FFI: ", ffi 
     21    file=os.path.join("..", "data_files", "%s.na" % ffi) 
     22    if not os.path.exists(file): file=os.path.join("..", "data_files", "%sa.na" % ffi) 
     23    f=nappy.openNAFile(file) 
     24    f.readData() 
     25    print "DX:",f.DX 
     26    print "VNAME", f.VNAME 
     27    print "V:",f.V[0] 
     28 
     29    if f.NAUXV>1: 
     30        print "AUX:" 
     31        print f.ANAME[0], f.ASCAL[0] 
     32        print f.A[0] 
  • nappy/trunk/test/testWrites.py

    r339 r344  
    1 import sys ; sys.path.append("..") 
    2 import naCore, textParser, naFile, general 
    3 reload(naCore) ; reload(textParser) ; reload(naFile) ; reload(general) 
     1#!/usr/bin/env python 
     2 
     3""" 
     4testWrites.py 
     5============== 
     6 
     7Tests all working write routines for nappy package. 
     8 
     9""" 
     10 
     11import os 
     12import sys ; sys.path.append(os.path.join("..","..")) 
     13import nappy ; reload(nappy) 
    414 
    515for ffi in [1001, 2010, 3010, 4010]: 
    6     x=general.openNAFile(r'../data_files/%s.na' % ffi) 
     16    infile=os.path.join("..", "data_files", "%s.na" % ffi) 
     17    print "Reading in ", infile 
     18    x=nappy.openNAFile(infile) 
     19    x.readData() 
    720    d=x.getNADict() 
    821    del d["FFI"] 
    922 
    10     print "Writing output file output/out%s.na..." % ffi 
    11     y=general.openNAFile(r'..\output\out%s.na' % ffi, 'w', d) 
     23    outfile=os.path.join("..", "output", "out%s.na" % ffi) 
     24    print "Writing output ", outfile 
     25    y=nappy.openNAFile(outfile, 'w', d) 
    1226    print "\nFile written successfully, so let's open it." 
    1327 
    14     x=general.openNAFile(r'..\output\out%s.na' % ffi) 
     28    x=nappy.openNAFile(outfile) 
    1529    print "variables are:\n" 
    1630    print x.getVariables() 
Note: See TracChangeset for help on using the changeset viewer.