Project

General

Profile

« Previous | Next » 

Revision 40fa0bbd

Added by Benoit Parmentier over 8 years ago

more changes to skip matching to LST, as reference in the mosaicing script

View differences:

climate/research/oregon/interpolation/global_run_scalingup_mosaicing_function.R
251 251
    #rast_ref_name <- r_mask_raster_name
252 252
    r_ref <- raster(raster_ref_name)
253 253
    extent_r_ref <- as.numeric(as.matrix(extent(r_ref)))
254
    res_pix <- res(r_mask)
254
    res_pix <- res(r_ref)
255 255
    #c(xmin,ymax,xmax,ymin)
256 256
    #c(ulx,uly,lrx,lry)
257 257
    extent_str <- c(extent_r_ref[1],extent_r_ref[4],extent_r_ref[3],extent_r_ref[2])
......
894 894
                     "--overwrite",sep=" ") #division by zero is problematic...
895 895
    system(cmd_str3)
896 896
    
897
    if(!is.null(r_mask_raster_name)){
898
      #different extent between mask and output if match extent is false!!
897
    ## Skipping this step now...
898
    #if(!is.null(r_mask_raster_name)){
899
       #different extent between mask and output if match extent is false!!
899 900
      #match resolution and extent first
900 901
      
901
      #lf_files <- c(r_m_weighted_mean_raster_name) #file(s) to be matched
902
      lf_files <- c(r_m_weighted_mean_raster_name) #match to mask
903
      rast_ref <- r_mask_raster_name
904
      raster(rast_ref)
905
      extent_r_mask <- extent(r_mask)
902
   #   #lf_files <- c(r_m_weighted_mean_raster_name) #file(s) to be matched
903
   #  lf_files <- c(r_m_weighted_mean_raster_name) #match to mask
904
   #    rast_ref <- r_mask_raster_name
905
   #    raster(rast_ref)
906
   #    extent_r_mask <- extent(r_mask)
906 907
      ##Maching resolution is probably only necessary for the r mosaic function
907 908
      #Modify later to take into account option R or python...
908
      list_param_raster_match <- list(lf_files,rast_ref,file_format,python_bin,out_suffix,out_dir)
909
      names(list_param_raster_match) <- c("lf_files","rast_ref","file_format","python_bin","out_suffix","out_dir_str")
909
   #   list_param_raster_match <- list(lf_files,rast_ref,file_format,python_bin,out_suffix,out_dir)
910
   #    names(list_param_raster_match) <- c("lf_files","rast_ref","file_format","python_bin","out_suffix","out_dir_str")
910 911

  
911
      #undebug(raster_match)
912
      r_m_weighted_mean_raster_name_matched <- raster_match(1,list_param_raster_match)
913
    }
912
   #undebug(raster_match)
913
   #   r_m_weighted_mean_raster_name_matched <- raster_match(1,list_param_raster_match)
914
   #}
914 915
    
915 916
    #writeRaster(r_m_weighted_mean, NAflag=NA_flag_val,filename=raster_name,overwrite=TRUE)  
916 917

  
......
918 919
    ##Can merge one and 2 with parentheses operations!!, make this a function?
919 920
    ##Reclassify with valid range: -100,100
920 921
    
921
    #raster_name <- r_m_weighted_mean_raster_name
922
    raster_name <- r_m_weighted_mean_raster_name_matched
922
    raster_name <- r_m_weighted_mean_raster_name
923
    #raster_name <- r_m_weighted_mean_raster_name_matched
923 924
    max_val <- valid_range[2]*scaling #set min_valid
924 925
    raster_name_rec1 <- file.path(out_dir_str,paste("r_m_",mosaic_method,"_weighted_mean_rec1_",out_suffix,"_tmp",".tif",sep=""))
925 926
    #rec_tmp1 <- file.path(out_dir_str,paste("r_m_",mosaic_method,"_weighted_mean_rec_",out_suffix,".tif",sep=""))

Also available in: Unified diff