登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 hillside 于 2017-3-14 12:54 编辑
"Python语言编程艺术——面向水文学子的编程"网页由荷兰阿姆斯特丹自由大学水文与地球环境系(Department of Hydrology and Geo-Environmental Sciences)的M. J. Waterloo博士维护。
http://python.hydrology-amsterdam.nl/
The art of Python programming(Python语言编程艺术)...
Why use a programming language to process data? Most students do their calculations in Excel or, if you do not have alicense, the alternative open source spreadsheet programme Calc from OpenOffice.However, suppose that you have long time series of meteorological data. InExcel the maximum row lenght would then be reached very quickly so that youwould have to divide your data over different sheets. This would be veryinefficient. It is also complicated to build a computer model in a spreadsheetprogram to simulate processes, such as groundwater flow, erosion, or release ofgreenhouse gases. In this case, professionals often revert to writing of a dedicated programthat can do the processing of data and do model calculations automatically. Themost common languages for programming are C programming language and its derivatives and Java and Fortranto name just a few. These languages are very powerful but have the disadvantagethat you have to write the program and then compile it to work with it. Another branch of programming languages are the interpretedlanguages. Commands can then typed in and are directly evaluated by theinterpreter, without compilation. A number of commands can be saved in a textfile, which is then called a script. Interpreted languages are Matlab, Python and GNUOctave. As a Matlab license is very costly we prefer to use the opensource Python language to work with. Python is a very versatile programminglangauge that can be used to process data in a rather easy way and this webpage will give you some hints and examples on how to use Python in yourscientific carreer. How to install Python If you are working with MS Windows (or Ubuntu Linux) go to the Python(xy)download page at www.pythonxy.organd under the Windows XP/Vista installer/administrator account, download the fulledition. Once downloaded, double-click on the installer and choose nextor I agree a couple of times until Python(xy) is installed. Please note that if you intend to print equations or special characters inany graphs that you want to plot with Python, you will need to install LaTeXfirst. Python(x,y) also makes several useful tools and programs available,including the Scientific PYthon Development EnviRonment (spyder), which isdesigned for interactive computing and data visualisation and has a simple andintuitive user interface. An alternative is the Anaconda Python distribution from ContinuumAnalytics. This is also a free Python distribution (including for commercialuse and redistribution) that contains about 300 popular Python packages. A third alternative distribution for MS Windows, MacOS or RedHat Linuxplatforms, is the Enthought Python Distribution, which contains allthe programs and tools that you will need. However, before you can downloadthis distribution you will have to register and the trial version of thisdistribution is only of unlimited duration for educational purposes, so youcannot use this commercially. If you use the Debianor UbuntuLinux platforms you can just install Python from a shell command line using thecommand: apt-get install python python-matplotlib. Learning Python There are many online tutorials. See, for instance, the Python Tutorialsweb site at www.awaretek.com. Python modules and scripts for Hydrologists and EarthScientists Several useful scripts are given below. You can in most cases easily adaptthese to your needs.
Subject | Python scripts and function libraries | Geophysics | | GPS and GIS scripts | - Python GIS: various Python modules for working with GIS - Python GPS, MapView, LatLongUTMconversion.
- Paul Inkenbrandt from the Utah Geological Survey has made several scripts that work with ArcGIS. The scripts include Stiff diagrams, Box and Whisker and Piper plots. His scripts scan be downloadedfrom https://github.com/inkenbrandt/Arcpy.
| NetCDF file operations | - txt2netcdf: various Python functions for importing text into NetCDF data files (creating files, adding variables, listing structure, etc.), developed by Ko van Huissteden.
| Meteorology | - meteolib: Python library containing meteorological functions for calculation of atmospheric vapour pressures, air density, latent heat of vapourisation, heat capacity at constant pressure, psychrometric constant, day length, extraterrestrial radiation input, potential temperature and wind vector. The documentation for this module is presented at here (meteolib module functions web site). Functions to convert event-based data records to equidistant time-spaced records (event2time) and to convert date values to day-of-year values (date2doy) are now in a separate meteo_util module. Documentation is presented here (meteo_util module functions web site). Module documentation is also available as a PDF document. Author: M.J. Waterloo.
| Hydrology | - evaplib: Python library containing functions for calculation of evaporation rates. Functions include Penman open water evaporation, Makkink reference evaporation, Priestley Taylor evaporation Penman Monteith (1965) evaporation and FAO's Penman Monteith ET0 reference evaporation for short, well-watered grass. In addition there is a function to calculate the sensible heat flux from temperature fluctuation measurements. View documentation of evaplib module functions. Module documentation is also available as a PDF document. Author: M.J. Waterloo.
- Groundwater flow modelling manual for Python written by Vincent post
| Hydrochemistry | | Workshop meteorological data processing | - Meteodataprocessing assignment manual: Meteorological data processingmanual for the script and data listed below. It also contains asection on how to report on these datausing LaTeX.
- meteoscript_yourname_2014.py:This script file is used for processing of meteorological datacollected during the hydrological field courses in Twente andPortugal. Author: M.J. Waterloo. The script reads the ASCII data,calculates state variables and actual evaporation (temperaturevariance energy balance method) and potential evaporation. It alsoplots time series of several weather variables. The script containsquestions that should be answered by the student to better understandwhat the script does. It makes use ofthe meteoliband evaplib modules presentedabove. Create an ecohydrology/pyscript directory and download and savethe script and modules in this directory.
- slowtable.dat: File containingmeteorological data collected in Portugal during the hydrologicalfield course in Aveiro, 2014. This is the output file of the CampbellScientific CR1000 data logger. Create an ecohydrology/data directoryand download and save the data file in this directory./li>
| Statistical Resources for Hydrologists | - RResources for Hydrologists: This weblog lists a lot of programsfor statistics in hydrologyusing R, which is a computerlanguage for statistical computing and graphics. Statistical functionsof R can be accessed in Python, for instancethrough Rpy
| Python hydrological modelling tools | - Vincent Post and others have developed a Python package to create, run and process MODFLOW, SEAWAT, MT3D and other MODFLOW based groundwater models. The software and documentation can be found at the FloPy3 web site and can be downloade from Github.
- Catchment and plant growth modelling frameworks (CMF, PMF), and statistical parameter optimisation tools (SPOTPY) programs were developed for Python at the Justus-Liebig-University in Giessen, Germany. The software and manuals are available for download at the website of Landscape, Water and Biogeochemical Cycles, together with the papers on which the programs are based.
- Sat Kumar Tomer from the Department of Civil Engineering - Indian Institute of Science has written an excellent Python in Hydrology handbook and also made several hydrology and earth sciences scripts available from his Ambhas project that can be downloaded from https://pypi.python.org/pypi/ambhas.
- Jaap Schellekens from Deltares in Delft, The Netherlands, has his WFLOW distributed hydrological modelling platform - part of the Openstreams project - available at http://schj.home.xs4all.nl/html/.
|
附1:《Python在水文学中的应用》英文书下载网址(附件已提供。为节约金币,群友可去网址自行下载):见回复帖。
附2:《Python在水文学中的应用》作者开发的Python程序:ambhas 0.4.0(https://pypi.python.org/pypi/ambhas)
|