• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

WEgeophysics / watex / 4448766469

pending completion
4448766469

Pull #174

github

GitHub
Merge 37ed18173 into c0c6c5ab8
Pull Request #174: redirect older release not to archive - update readme

35 of 47 branches covered (74.47%)

Branch coverage included in aggregate %.

381 of 394 relevant lines covered (96.7%)

0.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.74
/tests/test_datasets.py
1
# -*- coding: utf-8 -*-
2

3
import pandas as pd 
1✔
4
import  unittest 
1✔
5
import watex as wx  
1✔
6

7
class TestDatasets (unittest.TestCase) :
1✔
8
    """ Innner datasets tests. """
1✔
9
    def test_load_hlogs (self ): 
1✔
10
        """ Test Hydro-geological datasets
11
        Add new features: 
12
            - Able  to drop observation ``remark`` into the log data 
13
            - collect all data and aggregate them by passing  '*'  to the 
14
              parameter `key`. 
15
        Here is an example. 
16
        
17
        """
18
        # --- older methods 
19
        # fetch both data 
20
        h502 = wx.fetch_data('hlogs').frame 
1✔
21
        h2601 = wx.fetch_data('hlogs', key ='h2601').frame 
1✔
22
        # concat data 
23
        hdata_o = pd.concat ([h502, h2601])
1✔
24
        print( "data size:", len(hdata_o) )
1✔
25
        print( "mumber of columns=", len( hdata_o.columns )) 
1✔
26
        print( "columns\n:", hdata_o.columns )
1✔
27

28
        # the observation ("remark") columns sometimes does not 
29
        # contain a meaning full detail \so it can be dropped as
30
        hdata_o. drop (columns = 'remark', inplace = True )
1✔
31

32
        print( "columns\n:", hdata_o.columns )
1✔
33

34
        #-- in the newest version , both ( aggregation and drop ) can be 
35
        # performed in a single action by setting the ``key="*"` for concatenation 
36
        # or ``drop_observations`` param top ``True``. here is an example. 
37
        # - Aggregation 
38
        hdata = wx.fetch_data("hlogs", key ='*').frame 
1✔
39
        print( "data size:", len(hdata) ) 
1✔
40

41
        print( "mumber of columns=", len( hdata.columns )) 
1✔
42
        # - Drop observation of h502 borehole
43
        hdata = wx.fetch_data("hlogs", drop_observations =True ).frame 
1✔
44
        print( "Does observation still exist?", "remark" in hdata.columns) 
1✔
45

46
        # or --Do both actions 
47
        hdata = wx.fetch_data("hlogs", key='*', drop_observations =True ).frame 
1✔
48

49
        print( "Does observation still exist ?", "remark" in hdata.columns)
1✔
50
        print("show new data_size:", len(hdata ))
1✔
51
        
52
        self.assertEqual(len(hdata_o), len(hdata))
1✔
53

54
    def test_fetch_data (self ) :
1✔
55
        """ Test the boilerplate function """
56
        erp_data = wx.fetch_data ('tankesse', as_frame = True )
1✔
57
        ves_data = wx.fetch_data('semien', index_rhoa =2 )
1✔
58
        hlog_data = wx.fetch_data("hlogs" , key ='*').frame 
1✔
59
        edi_data = wx.fetch_data("edis", key='*').frame 
1✔
60
        results = [ 'resistivity' in d.columns 
1✔
61
                   for d in ( erp_data , ves_data, hlog_data, )
62
                   ]
63
        self.assertEqual(set (results ), {True} )
1✔
64
        self.assertEqual("edi" in edi_data.columns, True )
1✔
65

66
        
67
       
68
if __name__=='__main__':
1✔
69

70
    unittest.main()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc