socolofs / tamoc

Texas A&M Oilspill Calculator
MIT License
34 stars 13 forks source link

Some Issues with Startup #29

Open ArcticaNova opened 8 months ago

ArcticaNova commented 8 months ago

Hi,

After following the setup instructions for Mac I got two failed tests:

The error messages are below:

tamoc/tamoc/test/test_psm.py:598: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = (0.01920873078241585, 0.017327034580027646), kwds = {}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Items are not equal to 7 significant digits:
E            ACTUAL: 0.01920873078241585
E            DESIRED: 0.017327034580027646

opt/anaconda3/lib/python3.9/contextlib.py:79: AssertionError

tamoc/tamoc/test/test_sbm.py:254: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tamoc/tamoc/test/test_sbm.py:99: in get_profile
    nc = make_ctd_file()
tamoc/tamoc/test/test_sbm.py:76: in make_ctd_file
    test_ambient.test_from_ctd()
tamoc/tamoc/test/test_ambient.py:411: in test_from_ctd
    nc = check_nc_db(nc_file, summary, source, sea_name, p_lat,
tamoc/tamoc/test/test_ambient.py:100: in check_nc_db
    nc = ambient.create_nc_db(nc_file, summary, source, sea_name, p_lat,
tamoc/tamoc/ambient.py:1874: in create_nc_db
    nc = model_share.tamoc_nc_file(nc_file, title, summary, source)
tamoc/tamoc/model_share.py:65: in tamoc_nc_file
    nc = Dataset(fname, 'w', format='NETCDF4_CLASSIC')
src/netCDF4/_netCDF4.pyx:2469: in netCDF4._netCDF4.Dataset.__init__
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   ???
E   PermissionError: [Errno 13] Permission denied: '/Users/rishabhdave/tamoc/tamoc/test/output/test_BM54.nc'

src/netCDF4/_netCDF4.pyx:2028: PermissionError

I'm not particularly worried by the permission error, but the model seems to be producing positive gas values when it should be free of gas, which is concerning me.

Freelander1 commented 4 weeks ago

Using MacOS Darwin...

platform darwin -- Python 3.12.5, pytest-8.3.2, pluggy-1.5.0

... and running the full test suite I get:

4 failed, 73 passed, 79131 warnings in 32.04s

which include the same assertion error and same permission error as @ArcticaNova; The permission error is not fixed with sudo, it may be a latency issue.

and two more assertion errors:

../tamoc/test/test_blowout.py:542:


../../miniconda3/envs/tamoc/lib/python3.12/contextlib.py:81: in inner return func(*args, *kwds) ../../miniconda3/envs/tamoc/lib/python3.12/site-packages/numpy/_utils/init.py:85: in wrapper return fun(args, **kwargs)


args = (<function assert_array_almost_equal..compare at 0x135999760>, array([0.00350047, 0.00401725, 0.00461032, 0.00...9, 0.00451592, 0.00518261, 0.00594773, 0.0068258 , 0.0078335 , 0.00898997, 0.01031717, 0.01184031, 0.0135883 ])) kwds = {'err_msg': '', 'header': 'Arrays are not almost equal to 6 decimals', 'precision': 6, 'verbose': True}

@wraps(func)
def inner(*args, **kwds):
    with self._recreate_cm():
      return func(*args, **kwds)

E AssertionError: E Arrays are not almost equal to 6 decimals E
E Mismatched elements: 10 / 10 (100%) E Max absolute difference among violations: 0.00150049 E Max relative difference among violations: 0.11042572 E ACTUAL: array([0.0035 , 0.004017, 0.00461 , 0.005291, 0.006072, 0.006968, E 0.007997, 0.009178, 0.010533, 0.012088]) E DESIRED: array([0.003935, 0.004516, 0.005183, 0.005948, 0.006826, 0.007834, E 0.00899 , 0.010317, 0.01184 , 0.013588])

../../miniconda3/envs/tamoc/lib/python3.12/contextlib.py:81: AssertionError

../tamoc/test/test_blowout.py:911:


../tamoc/test/test_blowout.py:472: in check_simulation assert_approx_equal(spill.bpm.q[0,i], q0[i], significant=6)


args = (np.float64(4.221221396242331e-15), np.float64(3.69108722e-15)), kwds = {'significant': 6}

@wraps(func)
def inner(*args, **kwds):
    with self._recreate_cm():
      return func(*args, **kwds)

E AssertionError: E Items are not equal to 6 significant digits: E ACTUAL: 4.221221396242331e-15 E DESIRED: 3.69108722e-15

../../miniconda3/envs/tamoc/lib/python3.12/contextlib.py:81: AssertionError

../tamoc/test/test_psm.py:598:


args = (np.float64(0.01920873078241585), 0.017327034580027646), kwds = {}

@wraps(func)
def inner(*args, **kwds):
    with self._recreate_cm():
      return func(*args, **kwds)

E AssertionError: E Items are not equal to 7 significant digits: E ACTUAL: 0.01920873078241585 E DESIRED: 0.017327034580027646

../../miniconda3/envs/tamoc/lib/python3.12/contextlib.py:81: AssertionError

../tamoc/test/test_sbm.py:254:


../tamoc/test/test_sbm.py:99: in get_profile nc = make_ctd_file() ../tamoc/test/test_sbm.py:76: in make_ctd_file test_ambient.test_from_ctd() ../tamoc/test/test_ambient.py:411: in test_from_ctd nc = check_nc_db(nc_file, summary, source, sea_name, p_lat, ../tamoc/test/test_ambient.py:100: in check_nc_db nc = ambient.create_nc_db(nc_file, summary, source, sea_name, p_lat, ../tamoc/ambient.py:1874: in create_nc_db nc = model_share.tamoc_nc_file(nc_file, title, summary, source) ../tamoc/model_share.py:65: in tamoc_nc_file nc = Dataset(fname, 'w', format='NETCDF4_CLASSIC') src/netCDF4/_netCDF4.pyx:2470: in netCDF4._netCDF4.Dataset.init ???


??? E PermissionError: [Errno 13] Permission denied: ........./tamoc/tamoc/test/output/test_BM54.nc'

src/netCDF4/_netCDF4.pyx:2107: PermissionError

ChrisBarker-NOAA commented 4 weeks ago

The permission error is probably due to the netCDF4 library keeping files open to long -- it's pretty aggressive with that, and pytest can run things out of sync, which makes these issues crop up.

I wouldn't worry about that one -- though it would be good to try to fix it if it's happening consitently.

Freelander1 commented 4 weeks ago

Thanks Chris! Great to hear from you. It's been a while. Any thoughts on the assertion errors?


From: Chris Barker @.> Sent: Friday, September 6, 2024 7:15:34 PM To: socolofs/tamoc @.> Cc: Freelander1 @.>; Comment @.> Subject: Re: [socolofs/tamoc] Some Issues with Startup (Issue #29)

You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification ⚠ CAUTION: This email originated from an external sender. Verify the source before opening links or attachments. ⚠

The permission error is probably due to the netCDF4 library keeping files open to long -- it's pretty aggressive with that, and pytest can run things out of sync, which makes these issues crop up.

I wouldn't worry about that one -- though it would be good to try to fix it if it's happening consitently.

— Reply to this email directly, view it on GitHubhttps://github.com/socolofs/tamoc/issues/29#issuecomment-2334927839, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6J2SDHN2SDHSSUHDKBSZ7LZVIZRNAVCNFSM6AAAAABNZM6VPKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZUHEZDOOBTHE. You are receiving this because you commented.Message ID: @.***>

ChrisBarker-NOAA commented 4 weeks ago

Sorry -- no idea on those :-(

Freelander1 commented 4 weeks ago

A mystery :-) Thanks!


From: Chris Barker @.> Sent: Friday, September 6, 2024 8:22:54 PM To: socolofs/tamoc @.> Cc: Freelander1 @.>; Comment @.> Subject: Re: [socolofs/tamoc] Some Issues with Startup (Issue #29)

You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification ⚠ CAUTION: This email originated from an external sender. Verify the source before opening links or attachments. ⚠

Sorry -- no idea on those :-(

— Reply to this email directly, view it on GitHubhttps://github.com/socolofs/tamoc/issues/29#issuecomment-2334963515, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6J2SDBLD5IG7GELQKDM5OLZVJBN5AVCNFSM6AAAAABNZM6VPKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZUHE3DGNJRGU. You are receiving this because you commented.Message ID: @.***>