
0)
Python lives here:
/data/home006/ronald.vogel/anaconda3

1)
Conda manages python environments and packages.
Additional environments are used to test different package versions,
   in particular, whether package versions work with which of their
   dependency's versions,
   or with what version of python itself (python3.6 vs python3.9, etc).

Instructions, see:
1) STAR IT python page:
   https://git.star.nesdis.noaa.gov/ITT/star-faq/-/wikis/Python
2) Conda Cheatsheet:
   laptop > Documents > Commerce Data Skills Training > 
      Intro Python 20160406 > conda-cheatsheet.pdf

Conda lives here:
/data/home006/ronald.vogel/.conda
          /envs/rv_env_main (example environment)
          /pkgs               <-- downloaded python packages are here
                                  note: for ALL environments!

2)
My python environments:
    Env't Name       Runs python  Notes
    ----------       -----------  -----
    rv_env_main      python3.6    all pkgs installed with conda
    rv_pip_installs  python3.9    xarray,netcdf4 installed with pip,
                                    all other pkgs installed w/ conda

Each environment's packages are here:
 /data/home006/ronald.vogel/.conda/envs/<ENVT NAME>/lib/pythonX.X/site-packages

  so these are my environments' package locations:
  /data/home006/ronald.vogel/.conda/envs/rv_env_main/lib/python3.6/site-packages
  /data/home006/ronald.vogel/.conda/envs/rv_pip_installs/lib/python3.9/site-packages

 and the environment's directory must be included in each python code's 
   shebang line in order to use that environment:
 #!/data/home006/ronald.vogel/.conda/envs/rv_env_main/bin/python3
      N.B. python3 -> python 3.6
 _OR_
 #!/data/home006/ronald.vogel/.conda/envs/rv_pip_installs/bin/python3
      N.B. python3 -> python 3.9



3)
To use python at the command line, activate/deactivate the conda environment:

# To activate an environment, use
#
#     $ conda activate rv_env_main
#
# To deactivate an active environment, use
#
#     $ conda deactivate

After activating, can:
   install packages
        conda install <package>
   run python scripts
        ./sample-python-script.py
        AND INCLUDE SHEBANG LINE TO CONDA ENVIRONMENT AS FIRST LINE IN
        THE PYTHON SCRIPT, for example:
        #!/data/home006/ronald.vogel/.conda/envs/rv_env_main/bin/python3
        _OR_
        #!/data/home006/ronald.vogel/.conda/envs/rv_pip_installs/bin/python3

I.e.
   $shell-prompt      conda activate rv_env_main
   $conda-env-prompt  ./sample-python-script.py
   $conda-env-prompt  conda deactivate
   $shell-prompt


4)
To run a python script from within a Bash script:

   Do not use "conda activate rv_env_main" or "conda deactivate"
   in the Bash script.
   Just call the python script, BUT if wanting to run in a conda env't,
   the python script needs to have the shebang line to the chosen 
   conda environment as the first line in the python script, for example:

   #!/data/home006/ronald.vogel/.conda/envs/rv_env_main/bin/python3
   _OR_
   #!/data/home006/ronald.vogel/.conda/envs/rv_pip_installs/bin/python3


5)
To update packages from a specific repository
   conda install -c conda-forge PKG-NAME
(more options in Conda Cheatsheet on laptop, see above)

To update PODAAC data-subscriber for bulk downloads and 
subscriptions (i.e. Downloader, Subscriber):
conda install -c conda-forge podaac-data-subscriber
!!!!! DOES NOT WORK FOR conda-forge, NO LATEST VERSION (tested 7/26/2023)
!!!!! (conda installed v 1.11 when it should have been v 1.14)
!!!!!   - requested PODAAC User Services to update conda-forge with
!!!!!     current version, but they responded it'll take too long
!!!!!     for them to get to it

