Python instllation and set up ============================= This page describes how to **install** and **set up Python** on the computer. Download Anaconda ----------------- Anaconda is a free, easy-to-install package and environment manager, which is "a distribution of the Python and R programming languages for scientific computing, that aims to simplify package management and deployment." by Wikipedia. Follow `the instructions of the Anaconda homepage `_ to download and install Anaconda. Create virtual environments --------------------------- If you use Python framework and library without a virtual environment, these libraries will be added in one place. As a result, the libraries may interface with each other and suddently nor work. To avoid this issue and continue to use your Python programming, I recommend to create a virtual environment isolated for Python projects. This means that each project has its own libraries and frameworks, which makes it easier to manage Python enviroments. How to create virtual environments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (This information is copied from `PyCLIM webpage `_.) Update conda .. literalinclude:: SRC/setup.txt :lines: 1 Create a virtual environment for each project. Enter your favorite project name in "env_weclim" of the command below. .. literalinclude:: SRC/setup.txt :lines: 2 Install packages in the created virtural enviroment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Numpy and Xarry are libraries for the multi-dimensional analysis. PANDAS, a popular data analysis tool, is also installed automatically when you install Xarray. .. literalinclude:: SRC/setup.txt :lines: 4 Matplotlib and Cartopy are libraries for xy plots and geosphatial mapping. .. literalinclude:: SRC/setup.txt :lines: 5 Dask is a library for effectively computing in paralle. .. literalinclude:: SRC/setup.txt :lines: 6 If you want to analyze a one-dimensinal dataset (such as time-series data), the above package will suffice. When performing multi-dimensional analysis using NetCDF format datasets such as climate model output, GeoCAT is a useful tool for data analysis and visualization. .. literalinclude:: SRC/setup.txt :lines: 8 'eof' is a library for empirical orthogonal function (EOF) analysis to identify the main variations of variables. 'geocat-datafiles' is a libary for calculating ocean stream function. .. literalinclude:: SRC/setup.txt :lines: 10 Activate the virtual environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Finally, activate the virtural environment named "env_weclim". .. literalinclude:: SRC/setup.txt :lines: 12 This command should be run every time you start your computer and start a project. Other tips ~~~~~~~~~~ Deactivate the virtual environment .. literalinclude:: SRC/setup.txt :lines: 14 Remove the virtual enviroment .. literalinclude:: SRC/setup.txt :lines: 15 Check if Python works Run a python script. Download and save this file: :download:`test.py ` and run the following python command. .. literalinclude:: SRC/setup.txt :lines: 17 If 'Hello, World!' is displayed, Python is working.