Changeset 3522 for nappy/trunk


Ignore:
Timestamp:
26/02/08 19:35:08 (12 years ago)
Author:
astephen
Message:

Fixed tests and some bugs in na_content_collector.py

Location:
nappy/trunk/nappy/nc_interface
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nappy/trunk/nappy/nc_interface/na_content_collector.py

    r3493 r3522  
    9494                            [var.id for var in aux_vars],  
    9595                            self.rank_zero_var_ids] 
    96             self.na_dict["NLHEAD"] = "-999" 
     96            self.na_dict["NLHEAD"] = -999 
    9797            self._defineNAVars(self.ordered_vars) 
    9898            self._defineNAAuxVars(aux_vars) 
     
    682682        """ 
    683683        # Check if DATE field previously known in NASA Ames file 
    684         time_now = time.strftime("%Y %m %d", time.localtime(time.time())).split() 
     684        time_now = [int(i) for i in time.strftime("%Y %m %d", time.localtime(time.time())).split()] 
     685 
    685686        if not self.na_dict.has_key("RDATE"): 
    686687            self.na_dict["RDATE"] = time_now 
     
    692693                comptime = cdtime.s2c(start_date) 
    693694                first_day = comptime.add(self.na_dict["X"][0], getattr(cdtime, unit.capitalize())) 
    694                 self.na_dict["DATE"] = str(first_day).split(" ")[0].replace("-", " ").split() 
     695                self.na_dict["DATE"] = [int(i) for i in str(first_day).split(" ")[0].replace("-", " ").split()] 
    695696            except: 
    696697                msg = "Nappy Warning: Could not get the first date in the file. You will need to manually edit the output file." 
    697698                print msg 
    698699                self.output_message.append(msg) 
    699                 self.na_dict["DATE"] = ("DATE", "NOT", "KNOWN") 
     700                self.na_dict["DATE"] = [-999] * 3  
    700701        else:  
    701702            if not self.na_dict.has_key("DATE"): 
     
    703704                print msg 
    704705                self.output_message.append(msg) 
    705                 self.na_dict["DATE"] = ("DATE", "NOT", "KNOWN") 
     706                self.na_dict["DATE"] = [-999] * 3  
    706707            else: 
    707708                pass # i.e. use existing DATE 
  • nappy/trunk/nappy/nc_interface/test_1010_to_1020.py

    r3470 r3522  
     1import nappy.nc_interface.na_to_nc 
    12import cdms 
    23 
     4print "Converting NAFile to NC file 1010.na" 
     5ncfile = "../../test_outputs/1010.nc" 
     6nafile = "../../data_files/1010.na" 
     7 
     8n = nappy.nc_interface.na_to_nc.NAToNC(nafile) 
     9n.writeNCFile(ncfile) 
    310print "Writing a 1020 file from 1010 already converted to NetCDF..." 
    4 ncfile = "../../test_outputs/1010.nc" 
    511f=cdms.open(ncfile) 
    612p_new = f('pressure', altitude=(10,85)) 
  • nappy/trunk/nappy/nc_interface/test_2010_to_2110.py

    r3478 r3522  
    1 import na_to_nc 
    2 import nc_to_na 
     1import nappy.nc_interface.na_to_nc 
     2import nappy.nc_interface.nc_to_na 
    33import os 
    44 
     
    1414 
    1515print "Reading:", infile 
    16 x = nc_to_na.NCToNA(infile, requested_ffi=ffi_out) 
     16x = nappy.nc_interface.nc_to_na.NCToNA(infile, requested_ffi=ffi_out) 
    1717 
    1818print "Writing:", outfile 
Note: See TracChangeset for help on using the changeset viewer.