Название | Earth Observation Using Python |
---|---|
Автор произведения | Rebekah B. Esmaili |
Жанр | География |
Серия | |
Издательство | География |
Год выпуска | 0 |
isbn | 9781119606918 |
Hurricane Michael (2018). Michael was a major hurricane that affect the Florida Panhandle of the United States. Michael developed as a tropical wave on October 7 in the southwest Caribbean Sea and grew into a Category 5 storm by October 10. Throughout its life cycle, Michael caused extensive flooding, leading to 74 deaths and $25 billion in damage. Several examples in this text utilize visible and infrared imagery of Hurricane Michael.
Louisiana Flood Event (2016). Thousands of homes were flooded in Louisiana when over 20 inches of rain fell between August 12 and August 21, 2016. The event began after a mesoscale convective system stalled over the area near Baton Rouge and Lafayette, Louisiana. I will use the IMERG global rainfall dataset to examine this event.
1.5 Summary
I have provided a brief overview of the many satellite missions and datasets that are available. This book has two main objectives: (1) to make satellite data and analysis accessible to the Earth science community through practical Python examples using real‐world datasets; and (2) to promote a reproducible and transparent scientific code philosophy. In the following chapters, I will focus on describing data conventions, common methods, and problem‐solving skills required to work with satellite datasets.
References
1 Tobin, D., Revercomb, H., Knuteson, R., Taylor, J., Best, F., Borg, L., et al. (2013). Suomi‐NPP CrIS radiometric calibration uncertainty. Journal of Geophysical Research: Atmospheres, 118(18), 10,589–10,600. https://doi.org/10.1002/jgrd.50809
2 Garner, R. (2015, July 10). ICESat‐2 Technical Requirements. www.nasa.gov/content/goddard/icesat‐2‐technical‐requirements
3 IBM (1989, January). Personal Computer Family Service Information Manual. IBM document SA38‐0037‐00. http://bitsavers.trailing‐edge.com/pdf/ibm/pc/SA38‐0037‐00_Personal_Computer_Family_Service:Information_Manual_Jul89.pdf
4 National Oceanic and Atmospheric Administration (2020, June 12). GOES‐R Series Level I Requirements (LIRD). www.goes‐r.gov/syseng/docs/LIRD.pdf.
2 OVERVIEW OF PYTHON
Python is a free and open‐source programming language. There are over 200,000 packages registered online that expand Python’s capabilities. This chapter provides a description of some useful packages for the Earth sciences. Some of these useful packages include NumPy, Pandas, Matplotlib, netCDF4, h5py, Cartopy, and xarray. These packages have a strong development base and a large community of support, making them appropriate for scientific investigation.
In this chapter, I discuss some reasons why Python is a valuable tool for Earth scientists. I will also provide an overview of some of the commonly used Python packages for remote sensing applications that I will use later in this book. Python evolves rapidly, so I expect these tools to improve and new ones to become available. However, these will provide a solid foundation for you to begin your learning.
2.1 Why Python?
Chances are, you may already know a little about what Python is and have some motivation to learn it. Below, I outline common reasons to use Python relevant to the Earth sciences:
Python is open‐source and free. Some of the legacy languages are for profit, and licenses can be prohibitively expensive for individuals. If your career plans include remaining at your current institution or company that supplies you with language licenses, then open source may not be of concern to you. But often, career growth means working for different organizations. Python is portable, which frees up your skillset from being exclusively reliant on proprietary software.
Python can increase productivity. There are thousands of supported libraries to download and install. For instance, if you want to open multiple netCDF files at once, the package called xarray can do that. If you want to re‐grid an irregular dataset, there is a package called pyresample that will do this quickly. Even more subject‐specific plots, like Skew‐T diagrams, have a prebuilt package called MetPy. For some datasets, you can download data directly into Python using OPenDAP. Overall, you spend less time developing routines and more time analyzing results.
Python is easy to learn, upgrade, and share. Python code is very “readable” and easy to modularize, so that functions can be easily expanded or improved. Further, low‐ or no‐cost languages like Python increase the shareability of the code. When the code works, it should be distributed online for other users’ benefit. In fact, some grants and journals require online dissemination.
You may already have knowledge of other computer languages such as IDL, MATLAB, Fortran, C++, or R. Learning Python does not mean you will stop using other languages or rewrite all your existing code. In many cases, other languages will continue to be a valuable part of your daily work. For example, there are a few drawbacks to using Python:
Python may be slower than compiled languages. While many of the core scientific packages compile code on the back end, Python itself is not a compiled language. For a novice user, Python will run more slowly, especially if loops are present in the code. For a typical user, this speed penalty may not be noticeable, and advanced users can tap into other runtime frameworks like Dask or Cython or even run compiled Fortran subroutines to enhance performance. However, new users might not feel comfortable learning these workarounds, and even with runtime frameworks and subroutines, performance might not improve. If speed is a concern, then Python could be used as a prototype code tool prior to converting into a compiled language.
New users often run packages “as‐is” and the contents are not inspected. There are thousands of libraries available, but many are open‐source, community projects and bugs and errors will exist. For example, irregular syntax can result whenever there is a large community of developers. Thus, scientists and researchers should be extra vigilant and only use vetted packages.
Python packages may change function syntax or discontinued. Python changes rapidly. While most developers refrain from abruptly changing syntax, this practice is not always followed. In contrast, because much of the work in developing these packages is on a volunteer basis, the communities supporting them could move on to other projects and those who take over could begin a completely new syntax structure. While this is unlikely to be the case for highly used packages, anything is possible. For example, a popular map plotting package called Basemap was discontinued in the module Matplotlib and replaced with Cartopy, which is an older code package. I recommend using packages that have backing from Earth science research institutions (e.g., the UK Met Office, NASA, Lamont, etc.) to raise confidence that the packages you choose to use will be relatively stable.
Unlike legacy languages such as Fortran and C++, there is no guarantee that code written in Python will remain stable for 30+ years. However, the packages presented in this book are “mature” and are likely to continue to be supported for many years. Additionally, you can reproduce the exact packages and versions using virtual environments (Section 11.3). This text highlights newer packages that save significant amounts of development time and streamline certain processes, including how to open and read netCDF files and gridding operations.