diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7cc2baf..696c9df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false matrix: os: [ "ubuntu-latest" ] - python-version: [ "3.8", "3.9", "3.10" ] + python-version: [ "3.9", "3.10" ] steps: - uses: actions/checkout@v2 - name: Cache conda @@ -34,13 +34,16 @@ jobs: - uses: conda-incubator/setup-miniconda@v2 with: activate-environment: test_env # Defined in ci/environment*.yml - auto-update-conda: false + miniforge-variant: Mambaforge + miniforge-version: latest + use-mamba: true python-version: ${{ matrix.python-version }} environment-file: ci/environment-${{ matrix.python-version }}.yml use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - name: Set up conda environment shell: bash -l {0} run: | + python -m pip install --no-deps molmass miepython git+https://github.com/MITgcm/xmitgcm.git petitRADTRANS==2.4.9 prt-phasecurve python -m pip install -e . conda list - name: Run Tests @@ -75,6 +78,7 @@ jobs: - name: Set up conda environment shell: bash -l {0} run: | + python -m pip install --no-deps molmass miepython git+https://github.com/MITgcm/xmitgcm.git petitRADTRANS==2.4.9 prt-phasecurve python -m pip install -e . conda list - name: Run Tests diff --git a/ci/environment-3.10.yml b/ci/environment-3.10.yml index 0abbf14..f331c9c 100644 --- a/ci/environment-3.10.yml +++ b/ci/environment-3.10.yml @@ -6,15 +6,20 @@ dependencies: - cubedsphere - pytest - codecov + - xmitgcm - pytest-cov - - xarray - - h5py - - numpy=1.21.5 - - setuptools=61.2.0 + - matplotlib + - astropy + - numpy + - scipy + - setuptools - netcdf4 + - pandas + - numba + - corner + - tqdm + - h5py + - pre-commit + - pymultinest + - seaborn - pip - - pip: - - git+https://github.com/MITgcm/xmitgcm.git - - miepython - - petitRADTRANS==2.4.9 - - prt-phasecurve diff --git a/ci/environment-3.8.yml b/ci/environment-3.8.yml deleted file mode 100644 index f4bb765..0000000 --- a/ci/environment-3.8.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: test_env -channels: - - conda-forge -dependencies: - - python=3.8 - - cubedsphere - - pytest - - codecov - - pytest-cov - - xarray - - h5py - - numpy=1.21.5 - - setuptools=61.2.0 - - netcdf4 - - pip - - pip: - - git+https://github.com/MITgcm/xmitgcm.git - - miepython - - petitRADTRANS==2.4.9 - - prt-phasecurve diff --git a/ci/environment-3.9.yml b/ci/environment-3.9.yml index 1fc4fc2..bd66780 100644 --- a/ci/environment-3.9.yml +++ b/ci/environment-3.9.yml @@ -6,16 +6,20 @@ dependencies: - cubedsphere - pytest - codecov + - xmitgcm - pytest-cov - - xarray - - h5py - - numpy=1.21.5 - - setuptools=61.2.0 + - matplotlib + - astropy + - numpy + - scipy + - setuptools - netcdf4 - - pip - - pip: - - git+https://github.com/MITgcm/xmitgcm.git - - miepython - - petitRADTRANS==2.4.9 - - prt-phasecurve - + - pandas + - numba + - corner + - tqdm + - h5py + - pre-commit + - pymultinest + - seaborn + - pip \ No newline at end of file diff --git a/ci/environment-xarraymaster.yml b/ci/environment-xarraymaster.yml index c151dbc..82adefa 100644 --- a/ci/environment-xarraymaster.yml +++ b/ci/environment-xarraymaster.yml @@ -6,15 +6,22 @@ dependencies: - cubedsphere - pytest - codecov + - xmitgcm - pytest-cov - - h5py - - numpy=1.21.5 - - setuptools=61.2.0 + - matplotlib + - astropy + - numpy + - scipy + - setuptools - netcdf4 + - pandas + - numba + - corner + - tqdm + - h5py + - pre-commit + - pymultinest + - seaborn - pip - pip: - - git+https://github.com/MITgcm/xmitgcm.git - git+https://github.com/pydata/xarray.git - - miepython - - petitRADTRANS==2.4.9 - - prt-phasecurve diff --git a/gcm_toolkit/tests/test_interface.py b/gcm_toolkit/tests/test_interface.py index 23cc3f7..fb4c040 100644 --- a/gcm_toolkit/tests/test_interface.py +++ b/gcm_toolkit/tests/test_interface.py @@ -43,15 +43,21 @@ def test_prt_interface(petitradtrans_testdata, all_raw_testdata): ) # add cloud properties - dsi_clouds = tools.get_models('0') - tmp = np.ones((len(dsi_clouds['time']), len(dsi_clouds['lat']), - len(dsi_clouds['lon']), len(dsi_clouds['Z_l']))) - dsi_clouds['ClAb'] = (('time', 'lat', 'lon', 'Z_l'), tmp*1e-5) - dsi_clouds['ClDs'] = (('time', 'lat', 'lon', 'Z_l'), tmp*1e2) - dsi_clouds['ClDr'] = (('time', 'lat', 'lon', 'Z_l'), tmp*1e3) - dsi_clouds['ClVf_Test1[s]'] = (('time', 'lat', 'lon', 'Z_l'), tmp*0.5) - dsi_clouds['ClVf_Test2[s]'] = (('time', 'lat', 'lon', 'Z_l'), tmp*0.5) - tools._replace_model('0', dsi_clouds) + dsi_clouds = tools.get_models("0") + tmp = np.ones( + ( + len(dsi_clouds["time"]), + len(dsi_clouds["lat"]), + len(dsi_clouds["lon"]), + len(dsi_clouds["Z"]), + ) + ) + dsi_clouds["ClAb"] = (("time", "lat", "lon", "Z"), tmp * 1e-5) + dsi_clouds["ClDs"] = (("time", "lat", "lon", "Z"), tmp * 1e2) + dsi_clouds["ClDr"] = (("time", "lat", "lon", "Z"), tmp * 1e3) + dsi_clouds["ClVf_Test1[s]"] = (("time", "lat", "lon", "Z"), tmp * 0.5) + dsi_clouds["ClVf_Test2[s]"] = (("time", "lat", "lon", "Z"), tmp * 0.5) + tools._replace_model("0", dsi_clouds) phases = np.linspace(0, 1, 50) interface = tools.get_prt_interface(pRT) @@ -113,9 +119,11 @@ def test_prt_interface(petitradtrans_testdata, all_raw_testdata): ) # test transit calculation set up - interface.set_data(time=expected["times"][-1], terminator_avg=True, lon_resolution=60) - assert (interface.dsi['lon'].values == [-90, 90]).all() - assert interface.dsi['lat'].values == [0] + interface.set_data( + time=expected["times"][-1], terminator_avg=True, lon_resolution=60 + ) + assert (interface.dsi["lon"].values == [-90, 90]).all() + assert interface.dsi["lat"].values == [0] # test transit calculation interface.chem_from_poorman("T", co_ratio=0.55, feh_ratio=0.0) @@ -129,7 +137,9 @@ def test_prt_interface(petitradtrans_testdata, all_raw_testdata): # test transit calculation interface.chem_from_poorman("T", co_ratio=0.55, feh_ratio=0.0) - wave, spectra = interface.calc_transit_spectrum(mmw=2.33, clouds=True, use_bruggemann=True) + wave, spectra = interface.calc_transit_spectrum( + mmw=2.33, clouds=True, use_bruggemann=True + ) assert sum(spectra) == 45237213620.53514 # Test if Pa works @@ -253,7 +263,7 @@ def test_PAC_interface(all_nc_testdata): pac2d.set_data(time=expected["times"][-1]) with pytest.raises(OSError): - pac1d.write_inputfile('non/existent/path') - pac2d.write_inputfile('non/existent/path') - pac2d.generate_lptfile('non/existent/path') - pac2d.generate_aptfiles('non/existent/path') + pac1d.write_inputfile("non/existent/path") + pac2d.write_inputfile("non/existent/path") + pac2d.generate_lptfile("non/existent/path") + pac2d.generate_aptfiles("non/existent/path")