Changeset 5867


Ignore:
Timestamp:
Oct 27, 2008, 3:21:44 PM (15 years ago)
Author:
kristy
Message:

Added a test to check that a point not in the specified zone can occur first.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r5745 r5867  
    64816481            assert zone==geo_reference.zone
    64826482
     6483    def test_urs2sts_nonstandard_projection_reverse(self):
     6484        """
     6485        Test that a point not in the specified zone can occur first
     6486        """
     6487        tide=0
     6488        time_step_count = 3
     6489        time_step = 2
     6490        lat_long_points =[(-21.,113.5),(-21.,114.5),(-21.,114.), (-21.,115.)]
     6491        n=len(lat_long_points)
     6492        first_tstep=ones(n,Int)
     6493        first_tstep[0]+=1
     6494        first_tstep[2]+=1
     6495        last_tstep=(time_step_count)*ones(n,Int)
     6496        last_tstep[0]-=1
     6497
     6498        gauge_depth=20*ones(n,Float)
     6499        ha=2*ones((n,time_step_count),Float)
     6500        ha[0]=arange(0,time_step_count)
     6501        ha[1]=arange(time_step_count,2*time_step_count)
     6502        ha[2]=arange(2*time_step_count,3*time_step_count)
     6503        ha[3]=arange(3*time_step_count,4*time_step_count)
     6504        ua=5*ones((n,time_step_count),Float)
     6505        va=-10*ones((n,time_step_count),Float)
     6506
     6507        base_name, files = self.write_mux2(lat_long_points,
     6508                                      time_step_count, time_step,
     6509                                      first_tstep, last_tstep,
     6510                                      depth=gauge_depth,
     6511                                      ha=ha,
     6512                                      ua=ua,
     6513                                      va=va)
     6514
     6515        urs2sts(base_name,
     6516                basename_out=base_name,
     6517                zone=50,
     6518                mean_stage=tide,verbose=False)
     6519
     6520        # now I want to check the sts file ...
     6521        sts_file = base_name + '.sts'
     6522
     6523        #Let's interigate the sww file
     6524        # Note, the sww info is not gridded.  It is point data.
     6525        fid = NetCDFFile(sts_file)
     6526
     6527        # Make x and y absolute
     6528        x = fid.variables['x'][:]
     6529        y = fid.variables['y'][:]
     6530
     6531        geo_reference = Geo_reference(NetCDFObject=fid)
     6532        points = geo_reference.get_absolute(map(None, x, y))
     6533        points = ensure_numeric(points)
     6534
     6535        x = points[:,0]
     6536        y = points[:,1]
     6537
     6538        #Check that all coordinate are correctly represented       
     6539        #Using the non standard projection (50)
     6540        for i in range(4):
     6541            zone, e, n = redfearn(lat_long_points[i][0], lat_long_points[i][1], zone=50)
     6542            assert allclose([x[i],y[i]], [e,n])
     6543            assert zone==geo_reference.zone
    64836544    def test_urs2stsII(self):
    64846545        """
Note: See TracChangeset for help on using the changeset viewer.