Package: octvi
octviPython package for downloading, mosaicking, or compositing MODIS-scale NDVI imageryUpdatesNew in Version 2.0.4A bug in theoctviconfigconsole script has been fixed. Setting a personal NASA app key is now possible.New in Version 2.0.2The default masking criteria for MxD09Q1, MxD13Q1, and MxD13Q4N imagery have been relaxed. MxD09Q1 files no longer remove "average" aerosol pixels, and pixels flagged as "cloud-adjacent", which were formerly removed, are now kept. For MxD13 imagery, masking previously relied on the simple "pixel reliability index." This method has been replaced with a more granular masking schema, closely resembling that used for MxD09 data.New in Version 2.0.0Downloading from the NASA distributed archives (DAACs) requires a personal app key. This key was previously provided as part of theoctvidistribution, but this is no longer the case as of Version 2.0.0. Instead, users must configure the module using a new console script,octviconfig. After installation, runoctviconfigto prompt the input of your personal app key. Information on obtaining app keys can be found athttps://ladsweb.modaps.eosdis.nasa.gov/tools-and-services/data-download-scripts/#tokens.MotivationI work on development of the Global Agriculture Monitoring (GLAM) system. A core feature of the system is the ability to display large amounts of Vegetation Index (VI) imagery, pulled from sources like the MODIS and VIIRS satellite sensors. Obviously, displaying that imagery through our system requires the ability to download it from its source. This is harder than it sounds, especially when we also want to extract specific subdatasets, convert to a different file format, and mosaic dozens of individual "tiles" into a single global image.This package started out as a local tool for that very purpose. The name "octvi" comes from the fact that, at first, I planned to restrict functionality to 8-day (oct) vegetation indices (vi). Over time, though, I realized it was fairly simple to support more imagery products, including 16-day vegetation indices and even DIY multi-day composites. When other researchers in my department started asking to use the package, I realized it needed to be more accessible.FeaturesThe primary functionality of theoctvimodule is the creation of global mosaics of Normalized Difference Vegetation Index (NDVI) imagery. Supported imagery products include:MODIS 8-day NDVITerra (MOD09Q1)Aqua (MYD09Q1)MODIS 16-day NDVITerra (MOD13Q1)Aqua (MYD13Q1)VIIRS 8-day NDVI (VNP09H1)LANCE Near Real-TimeMODIS 8-day Terra (MOD09Q1N)MODIS 16-day Terra (MOD13Q4N)MODIS 8-day Climate Modeling Grid (CMG)-scale NDVI/GCVI (MOD09CMG; custom compositing)Note that MOD09CMG supports Green Chlorophyll Vegetation Index (GCVI) as well as NDVICode Exampleimportoctvi# import module# create a list of all days in January 2019 for which there exists valid VNP09H1 imageryviirsJanuaryDates=octvi.url.getDates("VNP09H1","2019-01")# generate global NDVI mosaic of MOD09Q1 data for an 8-day period starting on January 1st, 2019octvi.globalVi("MOD09Q1","2019-01-01","C:/temp/example_standard.tif")# generate custome composite of CMG-scale GCVI for an 8-day period starting on January 1st, 2019octvi.globalVi("MOD09CMG","2019-01-01","C:/temp/example_cmg.tif",vi="GCVI")How to UseIn PythonTheoctvipackage contains four submodules:url,extract,array, andexceptions. Most of the features you will want, though, are in the top-level module.The core functionality is shown in the code example above. Once the package is installed, you can import it in a script or REPL, and then use all the submodules freely. Whenoctviis imported, all submodules are also automatically imported and their namespaces can be accessed as shown withoctvi.url.getDates()above.On the Command LineThe package comes with one console script entry point:octvidownload. This script takes three arguments: product name (e.g. 'MOD09Q1'), date in %Y-%m-%d format (e.g. '2019-01-01') and output directory. Calling the script creates a global NDVI mosaic of the requested product on the requested day. If the product is daily Climate Modeling Grid-scale imagery (e.g. MOD09CMG), the script instead produces its own 8-day composite, with the 'date' argument being the first day of the compositing period.LicenseMIT LicenseCopyright (c) 2020 F. Dan O'NeillPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.