Advertisement
Guest User

Untitled

a guest
Jan 14th, 2012
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.38 KB | None | 0 0
  1. #string with month names
  2. IN="oktobris;novembris;decembris;janvaris;februaris;marts;aprilis;maijs;junijs;julijs;augusts;septembri"
  3.  
  4. #create an array splitting the string by ";"
  5. arr=$(echo $IN | tr ";" "\n")
  6.  
  7.  
  8. #-----boolean switches ------
  9. #switch for interpolation on
  10. #or off
  11. #interpSwitch=0
  12.  
  13. interpSwitch=1
  14. statisticSwitch=1
  15.  
  16. #----------------------------
  17.  
  18.  
  19. #----------INTERPOLATING----------
  20. #if switch is "on"
  21. if [ "$interpSwitch" = 1 ]; then
  22.  
  23. #iterate over an array
  24. for x in $arr
  25. do
  26.     v.surf.idw input=vectorMapWithColumnsWithMonthlyData output=rasterMap_$x npoints=12 power=2 column=$x --o
  27. done
  28. fi
  29. #---------------------------------
  30.  
  31.  
  32. #----------STATISTICS--------------
  33. if [ "$statisticSwitch" = 1 ]; then
  34. #delete possibly previously created
  35. rm W:/scripts/output.txt
  36.  
  37. #iterate over an array
  38. for x in $arr
  39. do
  40. #r.univar results are plain text which could be pipelined to awk
  41. #splitting and getting exact information from r.univar text output. and
  42. #finally writed in file. Each time element from the array are "catched" inside the awk as
  43. #a command line parameter and is used as the heading for each following statistics
  44.  
  45.     r.univar map=REF_rel_GW_unc83_$x | awk -v x="$x" 'BEGIN {printf "\r\n" x "\r\n" >> "W:/scripts/output.txt"} NR>6{split($0,a,":"); printf $0 "\r\n" >> "W:/scripts/output.txt"}'
  46.     echo "$x"
  47. done
  48. fi
  49.  
  50. #-----------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement