source: nappy/trunk/test/testWrites.py @ 366

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/nappy/trunk/test/testWrites.py@366
Revision 366, 1.0 KB checked in by astephen, 14 years ago (diff)

Latest version - for compatibility with web service. Includes multiple file
output on conversion from NetCDF.

  • 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
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, 2010, 3010, 4010]:                                      #08/05/04 selatham
21    infile=os.path.join("..", "data_files", "%s.na" % ffi)
22    print "Reading in ", infile
23    x=nappy.openNAFile(infile)
24    x.readData()
25    d=x.getNADict()
26    del d["FFI"]
27
28    outfile=os.path.join("..", "output", "out%s.na" % ffi)
29    print "Writing output ", outfile
30    y=nappy.openNAFile(outfile, 'w', d)
31    print "\nFile written successfully, so let's open it."
32
33    x=nappy.openNAFile(outfile)
34    print "variables are:\n"
35    print x.getVariables()
Note: See TracBrowser for help on using the repository browser.