Project

General

Profile

« Previous | Next » 

Revision dfe13c01

Added by Benoit Parmentier over 11 years ago

download and LST calc, modification of output and downloading of South America tiles

View differences:

climate/research/oregon/interpolation/download_and_produce_MODIS_LST_climatology.R
8 8
#
9 9
#AUTHORS: Benoit Parmentier    
10 10
#         based on modified earlier python scripts from J. Regetz
11
#DATE: 05/16/2013                                                                                 
11
#DATE: 05/20/2013                                                                                 
12 12

  
13 13
#PROJECT: NCEAS INPLANT: Environment and Organisms --TASK#???--   
14 14

  
......
18 18
  
19 19
  ###Function to download and calculate LST climatology from MODIS tiles
20 20
  #AUTHOR: Benoit Parmentier                                                                       
21
  #DATE: 05/16/2013                                                                                 
21
  #DATE: 05/20/2013                                                                                 
22 22
  #PROJECT: NCEAS INPLANT: Environment and Organisms --TASK#363--   
23 23
  
24 24
  #1) var 
......
92 92
  if (clim_calc==1){
93 93
    ##Now run climatology: Can add other climatology scripts or method to produce climatology later on...
94 94
    source(grass_setting_script) #Setting to access GRASS (current setting valid for Atlas at nceas)
95
    command_clim_str <- paste("python",clim_script, list_param_python_script_str,sep=" ")
95
    command_clim_str <- paste("python",clim_script, list_param_python_script_str,sep=" ") #preparing shell command
96 96
    system(command_clim_str)
97 97
    #/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/climatology_05132013.py
98 98
  }
99 99
  
100 100
  ## return list of files???, may be modified later to return clim list and list of downloaded files + missing.
101
  list_output_obj <-list(command_download_str,command_clim_str)
102
  names(list_output_obj) <- c("command_download_str", "command_clim_str")
101
  if (clim_calc==1){
102
    list_output_obj <-list(command_download_str,command_clim_str)
103
    names(list_output_obj) <- c("command_download_str", "command_clim_str")
104
  } else{
105
    list_output_obj <-list(command_download_str)
106
    names(list_output_obj) <- c("command_download_str")
107
  }
108
    #Add function to list files created or modify in python...
103 109
  
104 110
  return(list_output_obj)
105 111
}
......
109 115
#list_tiles_modis <- c("h11v08,h11v07,h12v07,h12v08,h10v07,h10v08") #tile for Venezuela and surrounding area
110 116
#list_tiles_modis <- c("h08v04,h09v04") #tiles for Oregon #defined above...
111 117
#list_tiles_modis <- c("h09v09,h10v09,h11v09,h12v09,h13v09,h14v09")
112
#list_tiles_modis <- c("h09v09,h10v09,h11v09,h12v09,h13v09,h14v09,
113
#                       h10v10,h11v10,h12v11,h13v12,h14v10")
114
list_tiles_modis <-c("h30v10,h31v10,h32v10,h30v11,h31v11") #list("Queensland")
118
#list_tiles_modis <-c("h30v10,h31v10,h32v10,h30v11,h31v11") #list("Queensland")
115 119

  
116 120
#list_tiles_modis <- c("h08v04")
117 121
script_path<-"/home/parmentier/Data/IPLANT_project/env_layers_scripts/"
118 122
modis_download_script <- file.path(script_path,"modis_download_05142013.py") # LST modis download python script
119
clim_script <- file.path(script_path,"climatology_05132013.py") # LST climatology python script
123
clim_script <- file.path(script_path,"climatology_05142013.py") # LST climatology python script
120 124
grass_setting_script <- file.path(script_path,"grass-setup.R")
121
#source(file.path(script_path,"download_and_produce_MODIS_LST_climatology_05162013.R"))
122

  
123 125
var="TMIN"
124
#list_tiles_modis <- c("h08v04")
126
list_tiles_modis <- c("h11v11,h12v11,h13v11,h14v11,h11v12,h12v12,h13v12,h12v13,h13v13,h13v14,h14v14")
127

  
125 128
start_year = "2001"
126 129
end_year = "2010"
127
#end_year = "2002" #for testing (year included?)
128
#end_month= "12"
129
#start_month= "1"
130 130
hdfdir =  '/home/layers/commons/modis/MOD11A1_tiles' #destination file where hdf files are stored locally after download.
131 131
#hdfdir =  '/home/parmentier/Data/IPLANT_project/MOD11A1_tiles'
132 132
download=1
133 133
clim_calc=0
134
out_suffix_modis="_05172013"
135
#end_month= "12"
136
#start_month= "1"
134
out_suffix_modis="_05202013"
137 135

  
138 136
list_param_download_clim_LST_script <- list(list_tiles_modis,start_year,end_year,hdfdir,
139 137
                                 var,grass_setting_script,modis_download_script, clim_script,
......
141 139
names(list_param_download_clim_LST_script)<-c("list_tiles_modis","start_year","end_year","hdfdir",
142 140
                                   "var","grass_setting_script","modis_download_script","clim_script",
143 141
                                   "download","clim_calc","out_suffix_modis")
144
#debug(download_calculate_MODIS_LST_climatology)
142
debug(download_calculate_MODIS_LST_climatology)
145 143

  
146
#download_calculate_MODIS_LST_climatology(1,list_param_download_clim_LST_script)
144
download_calculate_MODIS_LST_climatology(1,list_param_download_clim_LST_script)
147 145

  
148 146
### END OF SCRIPT

Also available in: Unified diff