source: nappy/tags/nappy-beta-1-0/test/testWrites.py @ 363

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/nappy/tags/nappy-beta-1-0/test/testWrites.py@363
Revision 363, 1.3 KB checked in by anonymous, 15 years ago (diff)

This commit was manufactured by cvs2svn to create tag
'nappy-beta-1-0'.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
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
7# 18/11/04 updated selatham new write method
8"""
9testWrites.py
10==============
11
12Tests all working write routines for nappy package.
13
14"""
15
16import os
17import sys ; sys.path.append(os.path.join("..",".."))
18import nappy ; reload(nappy)
19
20for ffi in [1001, 1010, 1020, 2010, 2110, 2160, 2310, 3010, 4010]:
21#for ffi in [2160]:                                     #testing single format
22    infile=os.path.join("..", "data_files", "%s.na" % ffi)
23    print "Reading in ", infile
24    x=nappy.openNAFile(infile)
25    x.readData()
26    d=x.getNADict()
27    del d["FFI"]
28
29    outfile=os.path.join("..", "output", "out%s.na" % ffi)
30    print "Writing output ", outfile
31    y=nappy.openNAFile(outfile, 'w', d)
32    print "\nFile written successfully, so let's open it."
33
34    z=nappy.openNAFile(outfile)
35    print "variables are:\n"
36    print z.getVariables()
37    d2=z.getNADict()
38    z.readData()
39    print "DX:",z.DX
40    print "NX:" ,z.NX
41    print "X:", z.X
42    print "VNAME", z.VNAME
43    print "V:",z.V[0:]
44    print "\n"
Note: See TracBrowser for help on using the repository browser.