Last active
June 6, 2020 00:48
-
-
Save bennyistanto/d339ed47fd54fea048f6c31a031b412e to your computer and use it in GitHub Desktop.
Longterm MEAN, MAXIMUM, MINIMUM, STD for CHIRPS dekad data using arcpy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Import system modules | |
import optparse, sys, os, traceback, errno | |
import ast | |
import re | |
import json | |
import ConfigParser | |
import re | |
import logging | |
import arcpy | |
from arcpy.sa import * | |
#function | |
class VampireDefaults: | |
def __init__(self): | |
# set up logging | |
self.logger = logging.getLogger('Vampire') | |
logging.basicConfig(filename='vampire.log', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', | |
level=logging.DEBUG, filemode='w') | |
# load default values from .ini file | |
self.config = ExtParser() | |
cur_dir = os.path.join(os.getcwd(), 'vampire.ini') | |
ini_files = ['vampire.ini', | |
os.path.join(os.getcwd(), 'vampire.ini'), | |
cur_dir] | |
dataset = self.config.read(ini_files) | |
if len(dataset) == 0: | |
msg = "Failed to open/find vampire.ini in {0}, {1} and {2}".format(ini_files[0], ini_files[1], ini_files[2]) | |
raise ValueError, msg | |
self.countries = dict(self.config.items('country')) | |
self.countries = dict((k.title(), v) for k, v in self.countries.iteritems()) | |
self.country_codes_l = [] | |
self.country_codes = {} | |
for c in self.countries: | |
cc = ast.literal_eval(self.countries[c].replace("\n", "")) | |
if 'chirps_boundary_file' in ast.literal_eval(self.countries[c].replace("\n", "")): | |
_chirps_boundary_file = ast.literal_eval(self.countries[c].replace("\n", ""))['chirps_boundary_file'] | |
p = re.match(r'.*\$\{(?P<param>.*)\}.*', _chirps_boundary_file) | |
if p: | |
# has a reference | |
_chirps_boundary_file = _chirps_boundary_file.replace('${'+p.group('param')+'}', | |
self.config.get('CHIRPS', p.group('param'))) | |
cc['chirps_boundary_file'] = _chirps_boundary_file | |
if 'modis_boundary_file' in ast.literal_eval(self.countries[c].replace("\n", "")): | |
_modis_boundary_file = ast.literal_eval(self.countries[c].replace("\n", ""))['modis_boundary_file'] | |
p = re.match(r'.*\$\{(?P<param>.*)\}.*', _modis_boundary_file) | |
if p: | |
# has a reference | |
_modis_boundary_file = _modis_boundary_file.replace('${'+p.group('param')+'}', | |
self.config.get('MODIS', p.group('param'))) | |
cc['modis_boundary_file'] = _modis_boundary_file | |
self.countries[c] = cc | |
self.country_codes[cc['abbreviation']] = c | |
self.country_codes_l.append(cc['abbreviation']) | |
return | |
def get(self, section, item): | |
return self.config.get(section, item) | |
def get_home_country(self): | |
return self.config.get('vampire', 'home_country') | |
def get_country(self, country=None): | |
if not country: | |
return self.countries | |
return self.countries[country] | |
def get_country_code(self, country=None): | |
if country is None: | |
return self.country_codes | |
if country in self.countries: | |
return self.countries[country]['abbreviation'] | |
return | |
def get_country_name(self, country_code): | |
for c in self.countries: | |
if country_code.lower() == self.countries[c]['abbreviation'].lower(): | |
return c | |
return None | |
def print_defaults(self): | |
print self.config._sections | |
#function | |
class ExtParser(ConfigParser.SafeConfigParser): | |
#implementing extended interpolation | |
def __init__(self, *args, **kwargs): | |
self.cur_depth = 0 | |
ConfigParser.SafeConfigParser.__init__(self, *args, **kwargs) | |
def get(self, section, option, raw=False, vars=None): | |
r_opt = ConfigParser.SafeConfigParser.get(self, section, option, raw=True, vars=vars) | |
if raw: | |
return r_opt | |
ret = r_opt | |
re_oldintp = r'%\((\w*)\)s' | |
re_newintp = r'\$\{(\w*):(\w*)\}' | |
m_new = re.findall(re_newintp, r_opt) | |
if m_new: | |
for f_section, f_option in m_new: | |
self.cur_depth = self.cur_depth + 1 | |
if self.cur_depth < ConfigParser.MAX_INTERPOLATION_DEPTH: | |
sub = self.get(f_section, f_option, vars=vars) | |
ret = ret.replace('${{{0}:{1}}}'.format(f_section, f_option), sub) | |
else: | |
raise ConfigParser.InterpolationDepthError, (option, section, r_opt) | |
m_old = re.findall(re_oldintp, r_opt) | |
if m_old: | |
for l_option in m_old: | |
self.cur_depth = self.cur_depth + 1 | |
if self.cur_depth < ConfigParser.MAX_INTERPOLATION_DEPTH: | |
sub = self.get(section, l_option, vars=vars) | |
ret = ret.replace('%({0})s'.format(l_option), sub) | |
else: | |
raise ConfigParser.InterpolationDepthError, (option, section, r_opt) | |
self.cur_depth = self.cur_depth - 1 | |
return ret | |
vp = VampireDefaults() | |
nmonthly = ['01','02','03','04', '05', '06', '07', '08', '09', '10', '11', '12'] | |
ndekad = ['1','2','3'] | |
data_folder = "Z:\\Temp\\DryWetSeason\\Month3" | |
lta_folder = "Z:\\Temp\\DryWetSeason\\Statistics" | |
dekad_pattern = vp.get('CHIRPS', 'global_dekad_pattern') # global_monthly_pattern, global_seasonal_pattern, global_dekad_pattern | |
Moregex_dekad = re.compile(dekad_pattern) | |
def dekadLT(): | |
dictionary = {} | |
for i in nmonthly: | |
for j in ndekad: | |
index = i+j | |
content = [] | |
for file_dekad in os.listdir(data_folder): | |
if file_dekad.endswith(".tif") or file_dekad.endswith(".tiff"): | |
Moresult_dekad = Moregex_dekad.match(file_dekad) | |
Dmonth = Moresult_dekad.group('month') | |
Ddekad = Moresult_dekad.group('dekad') | |
if Ddekad == j and Dmonth == i: | |
content.append(os.path.join(data_folder, file_dekad)) | |
dictionary[index] = content | |
for k in nmonthly: | |
for l in ndekad: | |
index = k + l | |
listoffile = dictionary[index] | |
ext = ".tif" | |
newfilename_dekad_avg = 'chirps-v2.0.1981-2019.{0}.{1}.dekad.39yrs.avg{2}'.format(k, l, ext) | |
newfilename_dekad_std = 'chirps-v2.0.1981-2019.{0}.{1}.dekad.39yrs.std{2}'.format(k, l, ext) | |
newfilename_dekad_max = 'chirps-v2.0.1981-2019.{0}.{1}.dekad.39yrs.max{2}'.format(k, l, ext) | |
newfilename_dekad_min = 'chirps-v2.0.1981-2019.{0}.{1}.dekad.39yrs.min{2}'.format(k, l, ext) | |
print(newfilename_dekad_avg) | |
if arcpy.Exists(os.path.join(lta_folder, newfilename_dekad_avg)): | |
print(newfilename_dekad_avg + " exists") | |
else: | |
arcpy.CheckOutExtension("spatial") | |
outCellStatistics_avg = CellStatistics(listoffile, "MEAN", "DATA") | |
outCellStatistics_avg.save(os.path.join(lta_folder, newfilename_dekad_avg)) | |
arcpy.CheckInExtension("spatial") | |
if arcpy.Exists(os.path.join(lta_folder, newfilename_dekad_std)): | |
print(newfilename_dekad_std + " exists") | |
else: | |
arcpy.CheckOutExtension("spatial") | |
outCellStatistics_std = CellStatistics(listoffile, "STD", "DATA") | |
outCellStatistics_std.save(os.path.join(lta_folder, newfilename_dekad_std)) | |
arcpy.CheckInExtension("spatial") | |
if arcpy.Exists(os.path.join(lta_folder, newfilename_dekad_max)): | |
print(newfilename_dekad_max + " exists") | |
else: | |
arcpy.CheckOutExtension("spatial") | |
outCellStatistics_max = CellStatistics(listoffile, "MAXIMUM", "DATA") | |
outCellStatistics_max.save(os.path.join(lta_folder, newfilename_dekad_max)) | |
arcpy.CheckInExtension("spatial") | |
if arcpy.Exists(os.path.join(lta_folder, newfilename_dekad_min)): | |
print(newfilename_dekad_min + " exists") | |
else: | |
arcpy.CheckOutExtension("spatial") | |
outCellStatistics_min = CellStatistics(listoffile, "MINIMUM", "DATA") | |
outCellStatistics_min.save(os.path.join(lta_folder, newfilename_dekad_min)) | |
arcpy.CheckInExtension("spatial") | |
dekadLT() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[vampire] | |
home_country = LKA | |
base_data_dir = C:\PRIMA\data\Download | |
base_product_dir = C:\PRIMA\data | |
base_boundary_dir = C:\PRIMA\data\Shapefiles\Boundaries | |
base_national_boundary_dir = C:\PRIMA\data\Shapefiles\Boundaries\National | |
[directories] | |
gdal_dir = C:\OSGeo4W\bin | |
mrt_dir = C:\Program Files\MRT\bin | |
temp_dir = C:\PRIMA\data\temp | |
default_download = C:\PRIMA\data\Download | |
default_product = C:\PRIMA\data | |
default_output = C:\PRIMA\data | |
geoserver_data = C:\Program Files (x86)\GeoServer 2.11.0\data_dir\data\ | |
[database] | |
default_host = localhost | |
default_port = 5432 | |
default_user = prima_user | |
default_pw = prima_user | |
default_schema = public | |
impact_db = prima_impact | |
impact_area_table = vhi_area | |
impact_popn_table = vhi_popn | |
impact_crops_table = vhi_crops | |
rainfall_anomaly_db = prima_ra | |
rainfall_anomaly_table = rainfall_anomaly | |
vhi_db = prima_vhi_250m | |
vhi_table = vhi | |
spi_db = prima_spi_10day | |
spi_table = spi | |
[geodatabase] | |
config = { | |
'country': 'idn', | |
'storingConfig': 'file', #file for file gedatabase, ent for enterprise geodatabase | |
'product': ['spi_1_month'], | |
'template': {'rainfall_anomaly_1_month': 'D:\\SharedFolder\\DIO\\vampire\\rainfall_anomaly_avg.rft.xml', | |
'vhi_crop_1_month': 'D:\\SharedFolder\\DIO\\vampire\\VHI_Classified.rft.rft.xml', | |
'idn_vhi_monthly2': 'D:\\SharedFolder\\DIO\\idn_vhi_monthly2.rft.rft.xml', | |
'DSLR_01mm': 'D:\\IDN_GIS\\05_Analysis\\03_Early_Warning\\Days_Since_Last_Rain\\idn_cli_dslr_imerg.rft.xml', | |
'DSLR_05mm': 'D:\\IDN_GIS\\05_Analysis\\03_Early_Warning\\Days_Since_Last_Rain\\idn_cli_dslr_imerg.rft.xml', | |
'spi_dekad': 'D:\\SharedFolder\\DIO\\vampire\\standard_precipitation_index.rft.xml', | |
'spi_dekad': 'D:\\SharedFolder\\DIO\\vampire\\standard_precipitation_index.rft.xml', | |
'spi_3_month': 'D:\\SharedFolder\\DIO\\vampire\\standard_precipitation_index.rft.xml'}, | |
'summary': {'rainfall_anomaly_1_month': 'Monthly rainfall anomaly, percent of average 1981 - 2015', | |
'rainfall_anomaly_dekad': 'Dekad rainfall anomaly, percent of average 1981 - 2015', | |
'rainfall_anomaly_3_month': '3-Monthly rainfall anomaly, percent of average 1981 - 2015', | |
'spi_1_month': 'Monthly standard precipitation index, percent of average 1981 - 2015', | |
'spi_3_month': '3-Monthly standard precipitation index, percent of average 1981 - 2015', | |
'spi_dekad': 'Dekad standard precipitation index, percent of average 1981 - 2015', | |
'idn_vhi_monthly2': 'Monthly vegetation health index', | |
'vhi_crop_1_month': 'Monthly vegetation health index', | |
'DSLR_01mm': 'Days Since Last Rain with 1 mm Threshold', | |
'DSLR_05mm': 'Days Since Last Rain with 5 mm Threshold',}, | |
'tags': {'rainfall_anomaly_1_month': 'Rainfall, Anomaly, Indonesia, CHIRPS', | |
'rainfall_anomaly_dekad': 'Rainfall, Anomaly, Indonesia, CHIRPS', | |
'rainfall_anomaly_3_month': 'Rainfall, Anomaly, Indonesia, CHIRPS', | |
'spi_1_month': 'Rainfall, SPI, Indonesia, CHIRPS', | |
'spi_3_month': 'Rainfall, SPI, Indonesia, CHIRPS', | |
'spi_dekad': 'Rainfall, SPI, Indonesia, CHIRPS', | |
'vhi_crop_1_month': 'VHI, Indonesia, MODIS', | |
'DSLR_01mm': 'DSLR, Indonesia, IMERG, daily', | |
'DSLR_05mm': 'DSLR, Indonesia, IMERG, daily', | |
'idn_vhi_monthly2': 'VHI, Indonesia, MODIS'}, | |
'description': {'rainfall_anomaly_1_month': 'Rainfall anomaly derived from the monthly rainfall compare to the long term average (1981 - 2015). Rainfall data come from CHIRPS of University of California Santa Barbara', | |
'rainfall_anomaly_dekad': 'Rainfall anomaly derived from the dekad rainfall compare to the long term average (1981 - 2015). Rainfall data come from CHIRPS of University of California Santa Barbara', | |
'rainfall_anomaly_3_month': 'Rainfall anomaly derived from the 3-monthly rainfall compare to the long term average (1981 - 2015). Rainfall data come from CHIRPS of University of California Santa Barbara', | |
'vhi_crop_1_month': 'Monthly vegetation health index in crop area. EVI data and temperature data come from MODIS data', | |
'DSLR_01mm': 'Days Since Last Rain with 1 mm threshold. Data processed from IMERG daily data', | |
'DSLR_05mm': 'Days Since Last Rain with 1 mm threshold. Data processed from IMERG daily data', | |
'idn_vhi_monthly2': 'Monthly Vegetation Health Index (VHI) for Indonesia. Data processed from MODIS Enhanced Vegetation Index (EVI) and Land Surface Temperature (LST)', | |
'spi_1_month': 'Standard Precipitation Index derived from the difference between monthly rainfall to long term average compare to the long term standard deviation (1981 - 2015). Rainfall data come from CHIRPS of University of California Santa Barbara', | |
'spi_3_month': 'Standard Precipitation Index derived from the difference between monthly rainfall to long term average compare to the long term standard deviation (1981 - 2015). Rainfall data come from CHIRPS of University of California Santa Barbara', | |
'spi_dekad': 'Standard Precipitation Index derived from the difference between monthly rainfall to long term average compare to the long term standard deviation (1981 - 2015)Rainfall data come from CHIRPS of University of California Santa Barbara'}, | |
'credits': 'Dio Dafrista and Benny Istanto', | |
'ws': 'D:/SharedFolder/DIO/vampire/', | |
'keycode': 'D:/SharedFolder/DIO/vampire/keycodes', | |
'gdbpath': 'D:\\IDN_GIS\\05_Analysis\\03_Early_Warning\\Rainfall_Anomaly', | |
'sourcedata': 'D:/IDN_GIS/01_Data/03_Regional', | |
'postgreHost': 'localhost', | |
'dba': 'postgres', | |
'dbapass': 'Indonesia', | |
'sdeuser': 'sde', | |
'sdepass': 'sde_indonesia', | |
'proj': "PROJCS['WGS_1984_UTM_Zone_49S',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',111.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]];-5120900 1900 10000;-100000 10000;-100000 10000;0,001;0,001;0,001;IsHighPrecision", | |
'server_url': 'http://localhost:6080/arcgis/admin', | |
'sdeCatalog': 'C:/Users/dio.dafrista/AppData/Roaming/ESRI/Desktop10.3/ArcCatalog/', | |
'server_admin': '[email protected]', | |
'use_arcgis_desktop_staging_folder': 'False', | |
'username': '[email protected]', | |
'password': 'Semangat@2017' | |
} | |
[CHIRPS] | |
base_data_name = chirps-v2.0 | |
base_product_name = _cli_chirps-v2.0 | |
# FTP data directories | |
ftp_address = chg-ftpout.geog.ucsb.edu | |
ftp_user = anonymous | |
ftp_password = @anonymous | |
ftp_dir_daily = /pub/org/chg/products/CHIRPS-2.0/global_daily/tifs/p25/ | |
ftp_dir_monthly = pub/org/chg/products/CHIRPS-2.0/global_monthly/tifs/ | |
ftp_dir_dekad = pub/org/chg/products/CHIRPS-2.0//global_dekad/tifs/ | |
ftp_dir_pentad = pub/org/chg/products/CHIRPS-2.0/global_pentad/tifs/ | |
ftp_dir_seasonal = pub/org/chg/products/CHIRPS-2.0/global_3-monthly/tifs/ | |
# patterns MUST contain (?P<year>\d{4}) and (?P<month>\d{2}), (?P<dekad>\d{1}) or (?P<season>\d{6}) as appropriate | |
global_monthly_pattern = ^(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<month>\d{2})(?P<extension>\.tiff?)(?P<gzip>.*)?$ | |
global_seasonal_pattern = ^(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<season>\d{6})(?P<extension>\.tiff?)(?P<gzip>.*)?$ | |
global_dekad_pattern = ^(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<month>\d{2}).(?P<dekad>\d{1})(?P<extension>\.tiff?)?(?P<gzip>.*)?$ | |
global_daily_pattern = ^(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2})(?P<extension>\.tiff?)(?P<gzip>.*)?$ | |
regional_monthly_pattern = ^(?P<country>\w{3})_cli_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<month>\d{2})(?P<extension>\.tif)(?P<gzip>.*)?$ | |
regional_seasonal_pattern = ^(?P<country>\w{3})_cli_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<season>\d{6})(?P<extension>\.tif)(?P<gzip>.*)?$ | |
regional_dekad_pattern = ^(?P<country>\w{3})_cli_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<month>\d{2}).(?P<dekad>\d{1})(?P<extension>\.tif)(?P<gzip>.*)?$ | |
regional_daily_pattern = ^(?P<country>\w{3})_cli_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2})(?P<extension>\.tif)(?P<gzip>.*)?$ | |
crop_regional_output_monthly_pattern = _cli_{base_name}-{version}.{year}.{month}{extension} | |
crop_regional_output_seasonal_pattern = _cli_{base_name}-{version}.{year}.{season}{extension} | |
crop_regional_output_dekad_pattern = _cli_{base_name}-{version}.{year}.{month}.{dekad}{extension} | |
crop_regional_output_daily_pattern = _cli_{base_name}-{version}.{year}.{month}.{day}{extension} | |
data_dir = ${vampire:base_data_dir}\CHIRPS | |
home_country_product_dir = ${vampire:base_product_dir}\Rasters\Climate\Precipitation\CHIRPS | |
regional_product_dir_prefix = ${vampire:base_product_dir} | |
regional_product_dir_suffix = Rasters\Climate\Precipitation\CHIRPS | |
global_product_dir = ${vampire:base_product_dir}\Rasters\Climate\Precipitation\CHIRPS | |
home_country_chirps_boundary = ${vampire:base_product_dir}\Shapefiles\Boundaries\Subset\CHIRPS\idn_cli_chirps_20_005_deg_grid_diss_a.shp | |
regional_boundary_prefix = ${vampire:base_product_dir}\ | |
regional_boundary_suffix = Shapefiles\Boundaries\Subset\CHIRPS\ | |
regional_boundary_file = _bnd_subset_chirps_20_005_deg_grid_diss_a.shp | |
[CHIRPS_Rainfall_Anomaly] | |
output_dir = ${vampire:base_product_dir}\Analysis\Rainfall_Anomaly\ | |
ra_global_output_monthly_pattern = {base_name}-{version}.{year}.{month}.ratio_anom{extension} | |
ra_global_output_seasonal_pattern = {base_name}-{version}.{year}.{season}.ratio_anom{extension} | |
ra_global_output_dekad_pattern = {base_name}-{version}.{year}.{month}.{dekad}.ratio_anom{extension} | |
ra_regional_monthly_pattern = ^(?P<country>\w{3})_cli_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<month>\d{2}).ratio_anom(?P<extension>\.tif)$ | |
ra_regional_seasonal_pattern = ^(?P<country>\w{3})_cli_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<season>\d{6}).ratio_anom(?P<extension>\.tif)$ | |
ra_regional_dekad_pattern = ^(?P<country>\w{3})_cli_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<month>\d{2}).(?P<dekad>\d{1}).ratio_anom(?P<extension>\.tif)$ | |
ra_regional_output_monthly_pattern = {country}_cli_{base_name}-{version}.{year}.{month}.ratio_anom{extension} | |
ra_regional_output_seasonal_pattern = {country}_cli_{base_name}-{version}.{year}.{season}.ratio_anom{extension} | |
ra_regional_output_dekad_pattern = {country}_cli_{base_name}-{version}.{year}.{month}.{dekad}.ratio_anom{extension} | |
output_file_suffix = ratio_anom | |
interval = 10 | |
[CHIRPS_SPI] | |
output_dir = ${vampire:base_product_dir}\Analysis\Standardized_Precipitation_Index\ | |
spi_global_output_monthly_pattern = {base_name}-{version}.{year}.{month}.spi{extension} | |
spi_global_output_seasonal_pattern = {base_name}-{version}.{year}.{season}.spi{extension} | |
spi_global_output_dekad_pattern = {base_name}-{version}.{year}.{month}.{dekad}.spi{extension} | |
spi_regional_monthly_pattern = ^(?P<country>\w{3})_cli_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<month>\d{2}).spi(?P<extension>\.tif)$ | |
spi_regional_seasonal_pattern = ^(?P<country>\w{3})_cli_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<season>\d{6}).spi(?P<extension>\.tif)$ | |
spi_regional_dekad_pattern = ^(?P<country>\w{3})_cli_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<year>\d{4}).(?P<month>\d{2}).(?P<dekad>\d{1}).spi(?P<extension>\.tif)$ | |
spi_regional_output_monthly_pattern = {country}_cli_{base_name}-{version}.{year}.{month}.spi{extension} | |
spi_regional_output_seasonal_pattern = {country}_cli_{base_name}-{version}.{year}.{season}.spi{extension} | |
spi_regional_output_dekad_pattern = {country}_cli_{base_name}-{version}.{year}.{month}.{dekad}.spi{extension} | |
output_file_suffix = spi | |
interval = 10 | |
[CHIRPS_Longterm_Average] | |
global_lta_monthly_pattern = ^(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<month>\d{2}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>avg)(?P<extension>.tif$) | |
global_lta_seasonal_pattern = ^(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<season>\d{6}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>avg)(?P<extension>.tif$) | |
global_lta_dekad_pattern = ^(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<month>\d{2}).(?P<dekad>\d{1}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>avg)(?P<extension>.tif$) | |
global_lta_output_monthly_pattern = {base_name}-{version}.{yr_range}.{month}.{interval}.{num_yrs}.{type}{extension} | |
global_lta_output_seasonal_pattern = {base_name}-{version}.{yr_range}.{season}.{interval}.{num_yrs}.{type}{extension} | |
global_lta_output_dekad_pattern = {base_name}-{version}.{yr_range}.{month}.{dekad}.{interval}.{num_yrs}.{type}{extension} | |
regional_lta_monthly_pattern = ^(?P<country>\w{3})_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<month>\d{2}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>avg)(?P<extension>.tif$) | |
regional_lta_seasonal_pattern = ^(?P<country>\w{3})_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<season>\d{6}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>avg)(?P<extension>.tif$) | |
regional_lta_dekad_pattern = ^(?P<country>\w{3})_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<month>\d{02}).(?P<dekad>\d{1}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>avg)(?P<extension>.tif$) | |
lta_date_range = 1981-2016 | |
[CHIRPS_Longterm_Standard_Deviation] | |
global_ltsd_monthly_pattern = ^(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<month>\d{2}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>std)(?P<extension>.tif$) | |
global_ltsd_seasonal_pattern = ^(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<season>\d{6}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>std)(?P<extension>.tif$) | |
global_ltsd_dekad_pattern = ^(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<month>\d{2}).(?P<dekad>\d{1}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>std)(?P<extension>.tif$) | |
global_ltsd_output_monthly_pattern = {base_name}-{version}.{yr_range}.{month}.{interval}.{num_yrs}.{type}{extension} | |
global_ltsd_output_seasonal_pattern = {base_name}-{version}.{yr_range}.{season}.{interval}.{num_yrs}.{type}{extension} | |
global_ltsd_output_dekad_pattern = {base_name}-{version}.{yr_range}.{month}.{dekad}.{interval}.{num_yrs}.{type}{extension} | |
regional_ltsd_monthly_pattern = ^(?P<country>\w{3})_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<month>\d{2}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>std)(?P<extension>.tif$) | |
regional_ltsd_seasonal_pattern = ^(?P<country>\w{3})_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<season>\d{6}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>std)(?P<extension>.tif$) | |
regional_ltsd_dekad_pattern = ^(?P<country>\w{3})_(?P<base_name>chirps)-(?P<version>v\d{1}.\d).(?P<yr_range>\d{4}-\d{4}).(?P<month>\d{02}).(?P<dekad>\d{1}).(?P<interval>\w*).(?P<num_yrs>\d*yrs).(?P<type>std)(?P<extension>.tif$) | |
ltsd_date_range = 1981-2016 | |
[CHIRPS_Days_Since_Last_Rain] | |
default_threshold = 0.5 | |
default_max_days = 30 | |
output_dir = ${vampire:base_product_dir}\Analysis\Days_Since_Last_Rain | |
regional_dslr_output_pattern = {country}_cli_{base_name}-{version}.{year}.{month}.{day}.dslr{extension} | |
regional_dsld_output_pattern = {country}_cli_{base_name}-{version}.{year}.{month}.{day}.dsld{extension} | |
regional_wet_accum_output_pattern = {country}_cli_{base_name}-{version}.{year}.{month}.{day}.num_wet{extension} | |
regional_accum_output_pattern = {country}_cli_{base_name}-{version}.{year}.{month}.{day}.total_accum{extension} | |
[CHIRPS_subset] | |
idn = D:/IDN_GIS/01_Data/02_IDN/ShapeFiles/Boundaries/Subset/CHIRPS/idn_bnd_subset_chirps_20_005_deg_grid_diss_a.shp | |
mng = D:/IDN_GIS/01_Data/02_IDN/ShapeFiles/Boundaries/Subset/CHIRPS/mng_bnd_subset_chirps_20_005_deg_grid_diss_a.shp | |
[IMERG_subset] | |
idn = D:/IDN_GIS/01_Data/02_IDN/ShapeFiles/Boundaries/Subset/GPM/idn_bnd_subset_imerg_01_deg_grid_diss_a.shp | |
[MODIS] | |
user = elninoksp | |
password = elninoKSP2016 | |
vegetation_product = MOD13Q1.006 | |
land_surface_temperature_product = MOD11A2.006 | |
data_dir = ${vampire:base_data_dir}\MODIS | |
vegetation_download_dir = ${MODIS:data_dir}\${MODIS:vegetation_product}\HDF_MOD | |
vegetation_mosaic_dir = ${MODIS:data_dir}\${MODIS:vegetation_product}\Processed\HDF_MOD | |
temperature_download_dir = ${MODIS:data_dir}\${MODIS:land_surface_temperature_product}\HDF_MOD | |
modis_tile_pattern = ^(?P<product>MOD\d{2}[A,C,Q]\d{1}).A(?P<year>\d{4})(?P<dayofyear>\d{3}).(?P<tile>h\d{2}v\d{2}).(?P<version>\d{3})?.*.(?P<extension>\.hdf$) | |
modis_mosaic_output_pattern = {product}.{year}.{month}.{day}.{version}{extension} | |
modis_monthly_pattern = ^(?P<product>MOD\d{2}[A,C,Q]\d{1}).A?(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<version>\d{3})(?P<extension>\.hdf$) | |
tiles_IDN = h27v08,h27v09,h27v10,h28v08,h28v09,h28v10,h29v08,h29v09,h29v10,h30v08,h30v09,h30v10,h31v08,h31v09,h31v10,h32v08,h32v09,h32v10 | |
tiles_RBB = h00v09,h00v10,h01v09,h01v10,h01v11,h02v08,h02v09,h03v09,h03v10,h22v05,h23v05,h23v06,h24v05,h24v06,h24v07,h25v05,h25v06,h25v07,h25v08,h26v06,h26v07,h26v08,h27v04,h27v05,h27v06,h27v07,h27v08,h27v09,h28v05,h28v06,h28v07,h28v08,h28v09,h29v06,h29v07,h29v08,h29v09,h29v10,h30v07,h30v08,h30v09,h30v10,h31v08,h31v09,h32v09,h32v10,h33v09,h33v10,h33v11,h34v07,h34v08,h34v09,h34v10,h35v08,h35v09,h35v10 | |
home_country_vegetation_boundary = ${vampire:base_product_dir}\Shapefiles\Boundaries\Subset\MODIS\idn_phy_modis_1km_grid_diss_a.shp | |
regional_vegetation_boundary_file = _phy_modis_1km_grid_diss_a.shp | |
global_prefix = ${vampire:base_product_dir}\Global | |
home_country_prefix = ${vampire:base_product_dir}\ | |
regional_prefix = ${vampire:base_product_dir}\ | |
boundary_dir_suffix = Shapefiles\Boundaries\Subset\MODIS | |
[MODIS_PRODUCTS] | |
MOD13A3.005 = 1 1 | |
MOD13A3.005.EVI = [2] | |
MOD13A3.005.EVI_Name = 1_km_monthly_EVI | |
MOD13A3.005.interval = monthly | |
MOD13A3.005.boundary_filename = _bnd_subset_modis_1km_grid_diss_a.shp | |
MOD13A3.005.download_dir = ${MODIS:data_dir}\MOD13A3.005\HDF_MOD | |
MOD13A3.005.mosaic_dir = ${MODIS:data_dir}\MOD13A3.005\Mosaic | |
MOD13Q1.005 = 1 1 | |
MOD13Q1.005.EVI = [2] | |
MOD13Q1.005.EVI_Name = 250_m_16_days_EVI | |
MOD13Q1.005.interval = 16Days | |
MOD13Q1.005.boundary_filename = _bnd_subset_modis_250m_grid_diss_a.shp | |
MOD13Q1.005.download_dir = ${MODIS:data_dir}\MOD13Q1.005\HDF_MOD | |
MOD13Q1.005.mosaic_dir = ${MODIS:data_dir}\MOD13Q1.005\Mosaic | |
MOD13Q1.006 = 1 1 | |
MOD13Q1.006.EVI = [2] | |
MOD13Q1.006.EVI_Name = 250_m_16_days_EVI | |
MOD13Q1.006.interval = 16Days | |
MOD13Q1.006.boundary_filename = _bnd_subset_modis_250m_grid_diss_a.shp | |
MOD13Q1.006.download_dir = ${MODIS:data_dir}\MOD13Q1.005\HDF_MOD | |
MOD13Q1.006.mosaic_dir = ${MODIS:data_dir}\MOD13Q1.005\Mosaic | |
MOD11C3.005 = | |
MOD11C3.005.LST_Day = [1] | |
MOD11C3.005.LST_Day_Name = LST_Day | |
MOD11C3.005.LST_Night = [6] | |
MOD11C3.005.LST_Night_Name = LST_Night | |
MOD11C3.005.interval = monthly | |
MOD11C3.005.boundary_filename = _bnd_subset_modis_lst_005_grid_diss_a.shp | |
MOD11C3.005.download_dir = ${MODIS:data_dir}\MOD11C3.005\HDF_MOD | |
MOD11C3.005.mosaic_dir = | |
MOD11A2.005 = 1 1 1 1 1 | |
MOD11A2.005.LST_Day = [1] | |
MOD11A2.005.LST_Day_Name = LST_Day | |
MOD11A2.005.LST_Night = [5] | |
MOD11A2.005.LST_Night_Name = LST_Night | |
MOD11A2.005.interval = 8Days | |
MOD11A2.005.boundary_filename = _bnd_subset_modis_1km_grid_diss_a.shp | |
MOD11A2.005.download_dir = ${MODIS:data_dir}\MOD11A2.005\HDF_MOD | |
MOD11A2.005.mosaic_dir = ${MODIS:data_dir}\MOD11A2.005\Mosaic | |
MOD11A2.006 = 1 1 1 1 1 | |
MOD11A2.006.LST_Day = [1] | |
MOD11A2.006.LST_Day_Name = LST_Day | |
MOD11A2.006.LST_Night = [5] | |
MOD11A2.006.LST_Night_Name = LST_Night | |
MOD11A2.006.interval = 8Days | |
MOD11A2.006.boundary_filename = _bnd_subset_modis_1km_grid_diss_a.shp | |
MOD11A2.006.download_dir = ${MODIS:data_dir}\MOD11A2.005\HDF_MOD | |
MOD11A2.006.mosaic_dir = ${MODIS:data_dir}\MOD11A2.005\Mosaic | |
[MODIS_EVI] | |
evi_spectral_subset = [2] | |
evi_subset_name = 1_km_monthly_EVI | |
evi_extract_dir = ${MODIS:data_dir}\${MODIS:vegetation_product}\Processed\EVI | |
evi_dir_suffix = Rasters\Physical\Vegetation\${MODIS:vegetation_product}.EVI\By16Days | |
evi_pattern = ^(?P<product>MOD\d{2}[A,Q]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<version>\d{3}).(?P<subset>.*)(?P<extension>\.tif$) | |
evi_output_pattern = {product}.{year}.{month}.{day}.{version}.tif | |
evi_regional_pattern = ^(?P<country>\w{3})(?P<type>_\w{3}_)(?P<product>MOD\d{2}[A,Q]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<version>\d{3}).(?P<subset>.*)(?P<extension>\.tif$) | |
evi_regional_output_pattern = {country}_phy_{product}.{year}.{month}.{day}.{version}.{subset}{extension} | |
[MODIS_EVI_Long_Term_Average] | |
# idn_phy_MOD13A3.2000-2015.001.1_km_monthly_EVI.15yrs.avg | |
lta_pattern = ^(?P<country>\w{3})_phy_(?P<product>MOD\d{2}[A,Q]\d{1}).(?P<yr_range>\d{4}-\d{4}).(?P<day_of_yr>\d{3}).(?P<subset>.*).(?P<num_yrs>.*yrs).(?P<statistic>.*)(?P<extension>\.tif$) | |
lta_output_pattern = {country}{type}{product}.{yr_range}.{day_of_yr}.{subset}.{num_yrs}.{statistic}{extension} | |
lta_dir_suffix = Rasters\Physical\Vegetation\${MODIS:vegetation_product}.EVI\StatisticsBy16Days | |
[MODIS_NDVI] | |
ndvi_spectral_subset = [1] | |
ndvi_subset_name = 1_km_monthly_NDVI | |
ndvi_extract_dir = ${MODIS:data_dir}\${MODIS:vegetation_product}\Processed\NDVI | |
ndvi_input_pattern = ^(?P<product>MOD\d{2}[A,Q]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<version>\d{3})(?P<extension>\.hdf$) | |
ndvi_output_pattern = {product}.{year}.{month}.{day}.{version}.tif | |
[MODIS_LST] | |
lst_dir_suffix = Rasters\Climate\Temperature\MODIS\${MODIS:land_surface_temperature_product}\By8Days | |
lst_download_dir = ${MODIS:data_dir}\${MODIS:land_surface_temperature_product}\HDF_MOD | |
lst_day_dir = ${MODIS:data_dir}\${MODIS:land_surface_temperature_product}\Processed\Day | |
lst_night_dir = ${MODIS:data_dir}\${MODIS:land_surface_temperature_product}\Processed\Night | |
lst_dir = ${MODIS:data_dir}\${MODIS:land_surface_temperature_product}\Processed\Average | |
lst_pattern = ^(?P<product>MOD\d{2}[C,A]\d{1}).A(?P<year>\d{4})(?P<dayofyear>\d{3}).(?P<version>\d{3})?.*(?P<extension>\.hdf$) | |
lst_mosaic_pattern = ^(?P<product>MOD\d{2}A\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<version>\d{3})?.*(?P<extension>\.hdf$) | |
lst_output_pattern = {product}.{year}{dayofyear}.{version}.tif | |
lst_day_night_pattern = ^(?P<product>MOD\d{2}[C,A]\d{1}).(?P<year>\d{4})(?P<dayofyear>\d{3}).(?P<version>\d{3}).(?P<subset>\w*)(?P<extension>\.tif$) | |
lst_average_pattern = ^(?P<product>MOD\d{2}[C,A]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<version>\d{3})(?P<extension>\.tif$) | |
lst_average_output_pattern = {product}.{year}{dayofyear}.{version}.avg{extension} | |
lst_regional_pattern = ^(?P<country>\w{3})_cli_(?P<product>MOD\d{2}[C,A]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<version>\d{3})(?P<extension>\.tif$) | |
lst_regional_output_pattern = {country}_cli_{product}.{year}.{month}.{day}.{version}{extension} | |
[MODIS_LST_Long_Term_Average] | |
lta_pattern = ^(?P<country>\w{3})(?P<type>_cli_)(?P<product>MOD\d{2}[C,A]\d{1}).(?P<yr_range>\d{4}-\d{4}).(?P<day_of_yr>\d{3}).(?P<subset>.*).(?P<num_yrs>.*yrs).(?P<statistic>.*)(?P<extension>\.tif$) | |
lta_output_pattern = {product}.{yr_range}.{dayofyear}.{subset}.{num_yrs}.{statistic}{extension} | |
lta_regional_output_pattern = {country}{type}{product}.{yr_range}.{day_of_yr}.{subset}.{num_yrs}.{statistic}{extension} | |
lta_dir_suffix = Rasters\Climate\Temperature\MODIS\${MODIS:land_surface_temperature_product}\StatisticsBy8Days | |
[MODIS_VCI] | |
vci_product_dir = ${vampire:base_product_dir}\Analysis\Vegetation_Condition_Index | |
vci_pattern = ^(?P<country>\w{3})_phy_(?P<product>MOD\d{2}[Q,C,A]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<subset>\w*).VCI(?P<extension>\.tif$) | |
vci_output_pattern = {country}_phy_{product}.{year}.{month}.{day}.{subset}_VCI{extension} | |
[MODIS_TCI] | |
tci_product_dir = ${vampire:base_product_dir}\Analysis\Temperature_Condition_Index | |
tci_pattern = ^(?P<country>\w{3})_cli_(?P<product>MOD\d{2}[C,A]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<version>\d{3}).TCI(?P<extension>\.tif$) | |
tci_output_pattern = {country}_cli_{product}.{year}.{month}.{day}.{version}.TCI{extension} | |
[MODIS_VHI] | |
interval = 16 | |
vhi_product_dir = ${vampire:base_product_dir}\Analysis\Vegetation_Health_Index | |
vhi_output_pattern = {country}_phy_{product}.{year}.{month}.{day}.{subset}_EVI_VCI_VHI{extension} | |
vhi_crop_output_pattern = {country}_phy_{product}.{year}.{month}.{day}.{subset}_EVI_VCI_VHI_cropmask_iwmi{extension} | |
vhi_crop_pattern = ^(?P<country>\w{3})_phy_(?P<product>MOD\d{2}[Q,C,A]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<subset>\w*)_EVI_VCI_VHI_cropmask(?P<extension>\.tif$) | |
vhi_pattern = ^(?P<country>\w{3})_phy_(?P<product>MOD\d{2}[Q,C,A]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<subset>\w*)_EVI_EVI_VCI_VHI(?P<extension>\.tif$) | |
[DSLR] | |
DSLR_output_pattern = ^(?P<country>\w{3})_cli_dslr_(?P<threshold>\d{2})mm_threshold_(?P<year>\d{4})(?P<month>\d{2})(?P<day>\d{2})(?P<extension>\.tif$) | |
[hazard_impact] | |
vhi_interval = 16 | |
vhi_threshold = 20 | |
vhi_output_dir = ${vampire:base_product_dir}\Tabular\Vegetation_Health_Index | |
vhi_area_pattern = ^(?P<country>\w{3})_phy_(?P<product>MOD\d{2}[Q,C,A]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2})_vhi_impact_area_dsd(?P<extension>\.csv$) | |
vhi_popn_pattern = ^(?P<country>\w{3})_phy_(?P<product>MOD\d{2}[Q,C,A]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2})_vhi_impact_popn_dsd(?P<extension>\.csv$) | |
vhi_crops_pattern = ^(?P<country>\w{3})_phy_(?P<product>MOD\d{2}[Q,C,A]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2})_vhi_impact_crops_dsd(?P<extension>\.csv$) | |
#vhi_area_pattern = ^(?P<country>\w{3})_phy_(?P<product>MOD\d{2}[Q,C,A]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<subset>\w*)_vhi_area_dsd(?P<extension>\.csv$) | |
#vhi_popn_pattern = ^(?P<country>\w{3})_phy_(?P<product>MOD\d{2}[Q,C,A]\d{1}).(?P<year>\d{4}).(?P<month>\d{2}).(?P<day>\d{2}).(?P<subset>\w*)_vhi_popn_dsd(?P<extension>\.csv$) | |
vhi_area_output_pattern = {country}_phy_{product}.{year}.{month}.{day}_vhi_impact_area_dsd.csv | |
vhi_popn_output_pattern = {country}_phy_{product}.{year}.{month}.{day}_vhi_impact_popn_dsd.csv | |
vhi_crops_output_pattern = {country}_phy_{product}.{year}.{month}.{day}_vhi_impact_crops_dsd.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment