Example #1
0
 def testSanity(self):
     """cigaxg(cxgaig(n))==n for all n"""
     for name, proj, dims, xg, ig in self.knownValues:
         xgout = rpnstd.cigaxg(proj, ig[0], ig[1], ig[2], ig[3])
         igout = rpnstd.cxgaig(proj, xgout[0], xgout[1], xgout[2], xgout[3])
         self.assertEqual(igout, ig,
                          name + igout.__repr__() + xgout.__repr__())
Example #2
0
 def create_basefile(self):
     """create a basic test file for RPNFile tests"""
     #print("============ Create Base File ===============")
     self.erase_testfile()
     f = rpnstd.RPNFile(self.fname)
     (ig1, ig2, ig3, ig4) = rpnstd.cxgaig(self.grtyp, self.xg14)
     r0 = rpnstd.RPNMeta()
     r0.update(r0.defaultKeysVals())
     r0m = rpnstd.RPNMeta(r0,
                          nom='LA',
                          type='C',
                          ni=self.lad.shape[0],
                          nj=self.lad.shape[1],
                          nk=1,
                          grtyp=self.grtyp,
                          ig1=ig1,
                          ig2=ig2,
                          ig3=ig3,
                          ig4=ig4)
     self.la = rpnstd.RPNRec(data=self.lad, meta=r0m)
     r0m.nom = 'LO'
     self.lo = rpnstd.RPNRec(data=self.lod, meta=r0m)
     f.write(self.la)
     f.write(self.lo)
     f.close()
     return (self.la, self.lo)
Example #3
0
 def gridL(self,dlalo=0.5,nij=10):
     """provide grid and rec values for other tests"""
     grtyp='L'
     grref=grtyp
     la0 = 0.-dlalo*(nij/2.)
     lo0 = 180.-dlalo*(nij/2.)
     ig14 = (ig1,ig2,ig3,ig4) =  rpnstd.cxgaig(grtyp,la0,lo0,dlalo,dlalo)
     axes = (None,None)
     hasAxes = 0
     ij0 = (1,1)
     doCorners = 0
     (la,lo) = Fstdc.ezgetlalo((nij,nij),grtyp,(grref,ig1,ig2,ig3,ig4),axes,hasAxes,ij0,doCorners)
     grid = rpnstd.RPNGrid(grtyp=grtyp,ig14=ig14,shape=(nij,nij))
     return (grid,la,lo)
Example #4
0
 def gridL(self,dlalo=0.5,nij=10):
     """provide grid and rec values for other tests"""
     grtyp='L'
     grref=grtyp
     la0 = 0.-dlalo*(nij/2.)
     lo0 = 180.-dlalo*(nij/2.)
     ig14 = (ig1,ig2,ig3,ig4) =  rpnstd.cxgaig(grtyp,la0,lo0,dlalo,dlalo)
     axes = (None,None)
     hasAxes = 0
     ij0 = (1,1)
     doCorners = 0
     (la,lo) = Fstdc.ezgetlalo((nij,nij),grtyp,(grref,ig1,ig2,ig3,ig4),axes,hasAxes,ij0,doCorners)
     grid = rpnstd.RPNGrid(grtyp=grtyp,ig14=ig14,shape=(nij,nij))
     return (grid,la,lo)
Example #5
0
 def gridZL(self,dlalo=0.5,nij=10):
     """provide grid and rec values for other tests"""
     (g1,la1,lo1) = self.gridL(dlalo,nij)
     x_axis_d = lo1[:,0].reshape((lo1.shape[0],1)).copy('FORTRAN')
     y_axis_d = la1[0,:].reshape((1,la1.shape[1])).copy('FORTRAN')
     grtyp='L'
     la0 = 0.
     lo0 = 180.
     ig14 = (ig1,ig2,ig3,ig4) =  rpnstd.cxgaig(grtyp,0.,0.,1.,1.)
     ip134 = (1,2,1,1)
     g1.ig14 = ig14
     x_axis = rpnstd.RPNRec(x_axis_d,rpnstd.RPNMeta())
     y_axis = rpnstd.RPNRec(y_axis_d,rpnstd.RPNMeta())
     grid = rpnstd.RPNGrid(grtyp='Z',ig14=ip134,shape=(nij,nij),g_ref=g1,xyaxis=(x_axis,y_axis))
     return (grid,la1,lo1)
Example #6
0
 def gridZL(self,dlalo=0.5,nij=10):
     """provide grid and rec values for other tests"""
     (g1,la1,lo1) = self.gridL(dlalo,nij)
     x_axis_d = lo1[:,0].reshape((lo1.shape[0],1)).copy('FORTRAN')
     y_axis_d = la1[0,:].reshape((1,la1.shape[1])).copy('FORTRAN')
     grtyp='L'
     la0 = 0.
     lo0 = 180.
     ig14 = (ig1,ig2,ig3,ig4) =  rpnstd.cxgaig(grtyp,0.,0.,1.,1.)
     ip134 = (1,2,1,1)
     g1.ig14 = ig14
     x_axis = rpnstd.RPNRec(x_axis_d,rpnstd.RPNMeta())
     y_axis = rpnstd.RPNRec(y_axis_d,rpnstd.RPNMeta())
     grid = rpnstd.RPNGrid(grtyp='Z',ig14=ip134,shape=(nij,nij),g_ref=g1,xyaxis=(x_axis,y_axis))
     return (grid,la1,lo1)
Example #7
0
 def create_basefile(self):
     """create a basic test file for RPNFile tests"""
     #print "============ Create Base File ==============="
     self.erase_testfile()
     f = rpnstd.RPNFile(self.fname)
     (ig1,ig2,ig3,ig4) =  rpnstd.cxgaig(self.grtyp,self.xg14)
     r0 = rpnstd.RPNMeta()
     r0.update(r0.defaultKeysVals())
     r0m = rpnstd.RPNMeta(r0,nom='LA',type='C',ni=self.lad.shape[0],nj=self.lad.shape[1],nk=1,grtyp=self.grtyp,ig1=ig1,ig2=ig2,ig3=ig3,ig4=ig4)
     self.la = rpnstd.RPNRec(data=self.lad,meta=r0m)
     r0m.nom = 'LO'
     self.lo = rpnstd.RPNRec(data=self.lod,meta=r0m)
     f.write(self.la)
     f.write(self.lo)
     f.close()
     return (self.la,self.lo)
Example #8
0
 def testSanity(self):
     """cigaxg(cxgaig(n))==n for all n"""
     for name,proj,dims,xg,ig in self.knownValues:
         xgout = rpnstd.cigaxg(proj,ig[0],ig[1],ig[2],ig[3])
         igout = rpnstd.cxgaig(proj,xgout[0],xgout[1],xgout[2],xgout[3])
         self.assertEqual(igout,ig,name+igout.__repr__()+xgout.__repr__())
Example #9
0
 def testCxgaigKnownValues(self):
     """Cxgaig should give known result with known input"""
     for name,proj,dims,xg,ig in self.knownValues:
         igout = rpnstd.cxgaig(proj,xg[0],xg[1],xg[2],xg[3])
         self.assertEqual(igout,ig,name+igout.__repr__())
Example #10
0
 def testCxgaigKnownValues(self):
     """Cxgaig should give known result with known input"""
     for name,proj,dims,xg,ig in self.knownValues:
         igout = rpnstd.cxgaig(proj,xg[0],xg[1],xg[2],xg[3])
         self.assertEqual(igout,ig,name+igout.__repr__())