Tutorial 3: Setting up pyWaPOR for your own case study

3. Download input data

After setting up the project, the next step is to configure the input dataset and download data. Copy the example code below to your notebook and run the code cells.

  • Configure input dataset
summary = {            
            'elevation': {'COPERNICUS.GLO30'},
            'meteorological': {'GEOS5.inst3_2d_asm_Nx'},
            'optical': {'SENTINEL2.S2MSI2A_R20m'},
            'precipitation': {'CHIRPS.P05'},            
            'solar radiation': {'MERRA2.M2T1NXRAD.5.12.4'},
'statics': {'STATICS.WaPOR3'}, 'thermal': {'VIIRSL1.VNP02IMG'},
'soil moisture': {'FILE:{folder}{sep}se_root_out*.nc'},           
'_ENHANCE_': {"bt": ["pywapor.enhancers.dms.thermal_sharpener.sharpen"],}, '_EXAMPLE_': 'SENTINEL2.S2MSI2A_R20m', '_WHITTAKER_': {'SENTINEL2.S2MSI2A_R20m':{'method':'linear'}, 'VIIRSL1.VNP02IMG':{'method':'linear'},                                                                    },                       } project.load_configuration(summary = summary)

  • You may configure a custom set of input data sources. Select the source and product code from 

https://www.fao.org/aquastat/py-wapor/data_sources.html

    • Make sure that you have filled in all the categories (i.e.,  elevation, meteorological, optical, precipitation, solar radiation, statistics, and thermal). For the 'soil moisture' category, we will use the output of SERoot model. You may select more than one source of input data. If you do so, the data downloading and processing time will be longer.
    • For example, if you want to use MODIS thermal data instead of VIIRS, the above example can be modified as follows:
    summary = {            
                'elevation': {'COPERNICUS.GLO30'},
                'meteorological': {'GEOS5.inst3_2d_asm_Nx'},
                'optical': {'SENTINEL2.S2MSI2A_R20m'},
                'precipitation': {'CHIRPS.P05'},            
                'solar radiation': {'MERRA2.M2T1NXRAD.5.12.4'},
    'statics': {'STATICS.WaPOR3'}, 'thermal': {'MODIS.MYD11A1.061','MODIS.MOD11A1.061'}
    'soil moisture': {'FILE:{folder}{sep}se_root_out*.nc'},           
    '_ENHANCE_': {"lst": ["pywapor.enhancers.dms.thermal_sharpener.sharpen"],}, '_EXAMPLE_': 'SENTINEL2.S2MSI2A_R20m', '_WHITTAKER_': {'SENTINEL2.S2MSI2A_R20m':{'method':'linear'}, 'MODIS.MYD11A1.061':{'method':'linear'}, 
                               'MODIS.MOD11A1.061':{'method':'linear'},                                                                               },                       } project.load_configuration(summary = summary)
  • Set up account credentials to download data
project.set_passwords()

    • Depending on the selected data source and product, the code will prompt you to put in the user accounts and passwords that are required to download the configured input datasets. 
  • Download data
datasets = project.download_data()


This code will start the process of downloading input data for pywapor. When python kernel is running the cell, make sure that you have internet connection. 
When you run pywapor for your own case study, the downloading step might take longer due to server or other interruptions not all data may have been downloaded. Check the log of the download section for warnings if there are some input data are not completely downloaded. If the downloading step is finished, you should not receive any warning in the printouts of the downloading step. (i.e., between > DOWNLOADER and < DOWNLOADER) except for the missing se_root_out.nc, which will be created in the next step.

Notes:
Due to sever and internet interruption, you might see some warnings in the printed log that pywapor may continue without certain input data. If this happens, you will need to re-run the downloading step. For that, you will need to restart the kernel by select tab 'Kernel' > 'Restart Kernel'. Remove corrupted files in the input data folders. Then, run all the code cells again.