Python代写-HT 2020
时间:2021-10-04

Technical Aspects - version: HT 2020 Contents I Introduction to command-line environment 2 I.I How to open the terminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 I.II Paths and useful commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 I.III Text editors (suggestions) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 II How to install gfortran 5 III How to install NetCDF libraries 6 IV How to connect remotely to a computer 9 V Note about Python 10 1 I Introduction to command-line environment I.I How to open the terminal GNU/Linux You can either: ✓ Open the Dash by clicking the Ubuntu icon in the upper-left, typer ”terminal”, and select the Terminal application from the results that appear. ✓ Hit the keyboard shortcut Ctrl - Alt + T MacOS ✓ Press cmd / + . The search bar will open. ✓ Write ”terminal” and press the return key Windows ✓ Press  + R to open RUN dialog box. ✓ Write ”cmd”,and click/tap on OK. 2 I Introduction to command-line environment I.II Paths and useful commands GNU/Linux and MacOS are based on UNIX, therefore all the commands are similar for both OS. Windows, on the other hand, uses different command lines. Path Comment Paths are written using ”/” Paths are written using ”\” Example /Users/user/Desktop c:\Users\user\Desktop Change directory Command cd cd Example cd dirname cd dirname Create a new directory Command mkdir mkdir Example mkdir dirname mkdir dirname View the contents of a directory Command ls dir Print current working directory Command pwd cd Move (rename) a file/directory Command mv move Example mv infile outfile move infile outfile Copy a file Command cp copy Example cp file filecopy copy file filecopy Copy a directory Command cp -r xcopy Example cp -r dir dircopy xcopy dir dircopy Remove a file Command rm del Example rm filename del filername Remove a directory Command rm -r rd Example rm -r dirname rddirname 3 I Introduction to command-line environment I.III Text editors (suggestions) This is a list of some text editor that may be useful for this course. GNU/Linux ✓ You can use the default text editors in GNU/Linux: Emacs or Vim. Quick reference cards: 1. Emacs reference card  2. Vim quick reference card  MacOS ✓ You can install Emacs or Vim for Mac. - Emacs: https://emacsformacosx.com  - Vim (macVim): https://github.com/macvim-dev/macvim  ✓ Another alternative is to install Xcode (it may be useful in the future). - Open up the App Store application and search for ”Xcode - the suite of tools for developers” - Agree to Xcode licence. Once Xcode is downloaded, open up the Terminal app and type: sudo xcodebuild -license - Hit spacebar a few times as directed and then type: ’agree’. Windows ✓ You can use the default text editors in Windows: Notepad or Wordpad. ✓ Another recommended alternative is Atom. You can downloaded it from: https://atom.io/  4 II How to install gfortran GNU/Linux ✓ GNU/Linux should include by default the gfortran libraries. However, in case it is not installed, open up the terminal and type: sudo apt-get install gfortran MacOS ✓ The ”GCC Wiki” implementation described in the following procedure is typically the newest binary release of gfortran, but requires that you download a version appropriate for your architec- ture. I - Visit the GCC Wiki GFortranBinaries  page and scroll to the MacOS section. II - You could install the required libraries using different platforms such as MacPorts or Homebrew; or download an Apple-style installers from here . III - If your browser did not automatically mount the disk image, the double-click the dmg file to mount and open it. IV - Open the unmounted gfortran-{version}-{architecture} folder, double-click gfortran.pkg, and follow the prompts to install it. Windows ✓ Fortran libraries can be build under Windows using MSYS2 (https://www.msys2.org/ ). I - Download the installer and follow the configuration instructions described in https://www.msys2.org/  II - Once MSYS2 is configured and updated, install the required compilers and dependencies by typing in the MSYS2 terminal: pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-hdf5 pacman -S gcc gcc-fortran tar zlib make m4 III - (Optional) if you want to use the Windows terminal instead of the MSYS2 terminal, add C : \msys64\usr and C : \msys64\usr\bin to the PATH environment variable. 5 III How to install NetCDF libraries GNU/Linux ✓ Use a package manager to download libraries This approach is generally the easiest one provided you find a library which was compiled with the same compile you plan to use (gnu gfortran for example). Make sure you install development libraries and Fortran interface libraries. I - First update package metadata: sudo apt-get update II - Get the GNU compilers (if you have not installed them): sudo apt-get install gcc gfortran III - Install the basic netCDF libraries: sudo apt-get install libnetcdf-dev libnetcdff-dev IV - Check the NetCDF-Fortran configuration: nf-config --all The output should look like this: This netCDF-Fortran 4.4.3 has been built with the following features: --prefix -> /usr --includedir-> /usr/include --version -> netCDF-Fortran 4.4.3 The –prefix is the path to where the libraries will be installed. V - If to this point everything went fine, you could try a test run: wget https://www.unidata.ucar.edu/software/netcdf/examples/programs/simple_xy_wr.f90 gfortran simple_xy_wr.f90 -o test_nc.out -I/usr/lib -lnetcdff -lnetcdf -I/usr/include ./test_nc.out Make sure that the paths to the netcdf libraries are the correct ones. VI - If everything goes fine you should get: *** SUCCESS writing example file simple_xy.nc! 6 III How to install NetCDF libraries MacOS Taken from http://mazamascience.com/WorkingWithData/?p=1474  This installation may not work for the latest version of MacOS Catalina (version 10.15). An alternative way to install NetCDF can be done by using a software package manager such as Homebrew (https: //brew.sh/https://brew.sh/). I - Install Xcode Open up the App Store application and search for Xcode — the suite of tools for developers. II - Agree to Xcode license Once Xcode is downloaded, open up the Terminal app and type: sudo xcodebuild -license Hit spacebar a few times as directed and then type: ‘agree’. III - Install MacPorts Download the appropriate version of MacPorts from www.macports.org/install.php . Then click on the package to open up the package installer. After installation has finished you should close any Terminal windows and open up a new one that will now be aware of the new port command. Try it out with: port help ... port info netcdf IV - Install netcdf libraries and associated tools Each of the following installations will automatically install any dependencies. sudo port install netcdf ... port port install ncview V - Make sure you have X11 To install X11 just open the Utilities folder on your machine and click on the X11 icon. If X11 is not installed you will be prompted to install it. This will take you to the https://xquartz.macosforge.org  where you can download the disk image for the latest version of XQuartz. Once the download is finished, double click on the XQuartz.dmg file and again on the XQuartz package and walk through the installer. The last instruction is to log out and back in again. 7 III How to install NetCDF libraries Windows Instructions provided by Jimmy Thelander NetCDF libraries can be build under Windows using MSYS2 (https://www.msys2.org/ ). By following these instructions some utilities of the netCDF libraries may not be installed. I - Install and configure MSYS2 (follow the instructions on how to install gfortran on Windows) II - Download the NetCDF library. cd ~ wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.5.0.tar.gz III - Extract and build the netCDF libraries. tar -zxvf netcdf-4.5.0.tar.gz cd netcdf-4.5.0 ./configure --disable-netcdf-4 --disable-dap make make install IV - Download the NetCDF-Fortran library. cd ~ wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-4.4.4.tar.gz V - Extract and build the netCDF libraries. tar -zxvf netcdf-fortran-4.4.4.tar.gz cd netcdf-fortran-4.4.4 ./configure make make install 8 IV How to connect remotely to a computer GNU/Linux and MacOS ✓ Mac and Linux come with SSH clients that can help connecting to remote servers. However, X11 (the graphical user interface) is no longer included with OS X. X11 server and client libraries for OS X are available from the XQuartz project (http://xquartz.macosforge.org ). I - Login by typing ssh -XY





























































































































































































@

Windows
✓ Both SSH and the graphical user interface X11 are not included by default in Windows. There are
many options available but in this guide we will present how to install PuTTY. PuTTY is a free
implementation of Telnet and SSH for Windows, along with a xterm terminal emulator:
I - Download and install XMing:
http://sourceforge.net/projects/xming/ 
Select Multiple Windows and type the number 0 for Display number.
II - Download and install PuTTY:
https://the.earth.li/ sgtatham/putty/latest/x86/putty.exe 
After you have downloaded the installer for Windows, run it, and follow through the steps.
Unless you know what you are doing, stick with the default installation options. After download
completes, you are done with the installation.
To connect to a remote server using PuTTY, provide the hostname of the remote server and
the port number on which the SSH server is listening. The default port is 22. Make sure the
connection type is ssh.
III - Configure the X11 forwarding.
Scroll to Connection > SSH > X11. Check the box next to Enable X11 Forwarding. By
default the X Display location is empty. You can enter localhost:0. The remote authentication
should be set to MIT-Magic-Cookie-1.
IV - Login to the remote server
Go back to Session. Click Open to bring up the terminal and login using your userid/password.
9
V Note about Python
Installing Python
Different Python distributors can be used to install Python. We recommend to install Anaconda (see the
instruction on how to install it in https://docs.anaconda.com/anaconda/install/ .
The following packages are highly recommended to have installed
1. NumPy
2. SciPy
3. matplotlib
4. Basemap
5. netCDF4
6. Pandas
7. TkInter
8. Jupyter
Installing packages in Anaconda for all OS:
Python packages can be installed in then Anaconda Prompt (terminal on Linux or macOS) by entering
the following commander:
conda install
For more information check https://docs.anaconda.com/anaconda/user-guide/tasks/install-packages/ .
10

学霸联盟


essay、essay代写