Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 3 additions & 26 deletions Database/Submit_Full_Regional_Model_SOLA.bat
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,6 @@ REM PREP WORK
CD %~dp0
CD prep_macros

REM Now find R executable
set infile=path.txt
if exist %infile% (del %infile% /Q)
dir "C:\Program Files\R\*R.exe" /s /b >> %infile% 2>nul
set /p path2=<%infile%
set paren="
set rpath=%paren%%path2%%paren%
echo rpath = %rpath%
call :CheckEmpty2 %infile%
:Rpass
if exist %infile% (del %infile% /Q)
set rfile=create_distr_m01_files

REM -- Start DISTR & M01 Data Processing --
@ECHO.
@ECHO Start Time: %date% %time%
Expand All @@ -223,7 +210,9 @@ cd prep_macros
@ECHO.
@ECHO -- CREATING FILES FOR SPATIAL ANALYSIS --
@ECHO.
%rpath% CMD BATCH %rfile%.R
rem Activate R env
call %~dp0..\Scripts\manage\env\activate_env.cmd r
call Rscript create_distr_m01_files.R
if %ERRORLEVEL% GTR 0 (goto issue)

@ECHO.
Expand Down Expand Up @@ -449,18 +438,6 @@ goto end
pause
goto end

:CheckEmpty2
if %~z1 == 0 (goto badR)
goto Rpass

:badR
@ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ECHO COULD NOT FIND R INSTALLATION.
@ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ECHO.
pause
goto end

:mcmiss
@ECHO
@ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
67 changes: 44 additions & 23 deletions Scripts/manage/env/activate_env.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,66 @@ rem creates the environment before activating it.
rem Parameters:
rem 1 : emme
rem Activate the custom Emme environment instead of the TBM
rem environment (default).
rem environment (default).
rem 1 : r
rem Activate the custom R environment instead of the TBM environment.

if [%~1] == [emme] (set EMME_ENV=y) else (set EMME_ENV=n)
set PDIR=%~dp0

rem Define here the name of the TBM environment to be used.
set TBM_ENVNAME=CMAP-TRIP2
set PY_ENVNAME=tbm-py
rem Define here the name of the R environment to be used.
set R_ENVNAME=tbm-r
rem Define here the name of the custom Emme environment to be used.
set EMME_ENVNAME=emme-plus

call "%PDIR%set_condapath.cmd"
if %ERRORLEVEL% neq 0 (goto end)

if %EMME_ENV%==y (set ENVNAME=%EMME_ENVNAME%) else (set ENVNAME=%TBM_ENVNAME%)
if [%~1]==[emme] (
set ENVNAME=%EMME_ENVNAME%
) else if [%~1]==[r] (
set ENVNAME=%R_ENVNAME%
) else (
set ENVNAME=%PY_ENVNAME%
)
set ENVPATH=%CONDAPATH%\envs\%ENVNAME%

rem Create it if it doesn't exist.
if not exist "%ENVPATH%\python.exe" (
echo Python not found at "%ENVPATH%"
echo.
rem Activate the conda base environment.
rem Using call is required here, see:
rem https://stackoverflow.com/questions/24678144/conda-environments-and-bat-files
call "%CONDAPATH%\Scripts\activate.bat"
if %ERRORLEVEL% neq 0 (
echo Error in activating conda
goto end
)
rem Create it from a file.
echo Creating %ENVNAME% environment
echo.
call conda env create -f "%PDIR%%ENVNAME%.yml"
if [%~1]==[r] (
if not exist "%ENVPATH%\Scripts\Rscript.exe" (
echo R not found at "%ENVPATH%"
echo.
goto create
) else (goto activate)
) else (
if not exist "%ENVPATH%\python.exe" (
echo Python not found at "%ENVPATH%"
echo.
goto create
) else (goto activate)
)

:create
rem Activate the conda base environment.
rem Using call is required here, see:
rem https://stackoverflow.com/questions/24678144/conda-environments-and-bat-files
call "%CONDAPATH%\Scripts\activate.bat"
if %ERRORLEVEL% neq 0 (
echo Error in activating conda
goto end
)
rem Create it from a file.
echo Creating %ENVNAME% environment
echo.
call conda env create -f "%PDIR%%ENVNAME%.yml"

if %EMME_ENV%==y (
rem Add the path configuration file to include Emme Python libraries.
copy "%PDIR%emme.pth" "%ENVPATH%\Lib\site-packages"
)
if [%~1]==[emme] (
rem Add the path configuration file to include Emme Python libraries.
copy "%PDIR%emme.pth" "%ENVPATH%\Lib\site-packages"
)

:activate
rem Activate it.
call "%CONDAPATH%\Scripts\activate.bat" "%ENVPATH%"
if %ERRORLEVEL% neq 0 (
Expand Down
108 changes: 54 additions & 54 deletions Scripts/manage/env/CMAP-TRIP2.yml → Scripts/manage/env/tbm-py.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
# To use this file:
# conda env create -f CMAP-TRIP2.yml
name: CMAP-TRIP2
channels:
- conda-forge
dependencies:
- altair=4.1
- appdirs=1.4
- cloudpickle=2.0
- dask=2021.12
- datashader=0.13
- distributed=2021.12
- fiona=1.8
- geopandas=0.10
- gh=2.4
- git=2.34
- graphviz=2.50
- ipykernel=6.6
- ipyparallel=8.1
- ipywidgets=7.6
- joblib=1.1
- jupyter=1.0
- jupyter_contrib_nbextensions=0.5 # On conda-forge only
- larch=5.5.9
- matplotlib=3.5
- nb_conda=2.2
- notebook=6.4
- numba=0.53
- numpy=1.21
- numexpr=2.7
- pandas=1.3
- pip=21.3
- platypus-opt=1.0
- plotly=5.5
- pyarrow=6.0
- pydot=1.4
- pyscaffold=4.1
- pytest=6.2
- python=3.9
- python-kaleido=0.2 # Plotly Static Image Export
- pyzmq=22.3
- salib=1.4
- scikit-learn=1.0
- scipy=1.7
- seaborn=0.11
- shortuuid=1.0
- sqlalchemy=1.4
- statsmodels=0.13
- tbb=2021.4
- tbb4py=2021.4
- xarray=0.20
- zarr=2.10
- pip:
- emat
# To use this file:
# conda env create -f CMAP-TRIP2.yml
name: tbm-py
channels:
- conda-forge
dependencies:
- altair=4.1
- appdirs=1.4
- cloudpickle=2.0
- dask=2021.12
- datashader=0.13
- distributed=2021.12
- fiona=1.8
- geopandas=0.10
- gh=2.4
- git=2.34
- graphviz=2.50
- ipykernel=6.6
- ipyparallel=8.1
- ipywidgets=7.6
- joblib=1.1
- jupyter=1.0
- jupyter_contrib_nbextensions=0.5 # On conda-forge only
- larch=5.5.9
- matplotlib=3.5
- nb_conda=2.2
- notebook=6.4
- numba=0.53
- numpy=1.21
- numexpr=2.7
- pandas=1.3
- pip=21.3
- platypus-opt=1.0
- plotly=5.5
- pyarrow=6.0
- pydot=1.4
- pyscaffold=4.1
- pytest=6.2
- python=3.9
- python-kaleido=0.2 # Plotly Static Image Export
- pyzmq=22.3
- salib=1.4
- scikit-learn=1.0
- scipy=1.7
- seaborn=0.11
- shortuuid=1.0
- sqlalchemy=1.4
- statsmodels=0.13
- tbb=2021.4
- tbb4py=2021.4
- xarray=0.20
- zarr=2.10
- pip:
- emat
- cmap_modedest @ git+https://github.com/CMAP-REPOS/cmap_modedest@v24.4.1
8 changes: 8 additions & 0 deletions Scripts/manage/env/tbm-r.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: tbm-r
channels:
- conda-forge
dependencies:
- r-base=4.3
- r-foreign
- r-tidyverse
- r-sf