Geospatial data analysis in R

Raster data II

Josh Merfeld

KDI School

November 5, 2024

What are we doing today?

  • A short review of in-class lab 1

  • Installing Python and Positron for the GEE API

In-class lab 1

  • Let’s go over a few things from in-class lab 1

  • Three things I want to cover:

    • Making maps look nice
    • Creating a spatial object from points
    • Distances

Making maps look nice

  • let’s look at the grid cells:
Code
grids <- vect("assignments/in-class1/data/seoulgrid.shp")
ggplot(grids) +
  geom_spatvector(aes(fill = log(pop))) +
  scale_fill_distiller("Pop (log)", palette = "YlOrRd", direction = 1) +
  theme_bw()

Making maps look nice

Compare the previous map to this one:

Code
ggplot(grids) +
  geom_spatvector(aes(fill = log(pop)), color = NA) +
  scale_fill_distiller("Pop (log)", palette = "YlOrRd", direction = 1) +
  theme_bw()

Compare the previous map to this one:

Together

Spatial objects from points

  • Now let’s create a spatial object from points

  • Let’s use the schools:

Code
df <- read_csv("assignments/in-class1/data/seoulpoints.csv")
head(df)
# A tibble: 6 × 5
   code fclass           province   lon   lat
  <dbl> <chr>            <chr>    <dbl> <dbl>
1  2110 hospital         Seoul     127.  37.6
2  2082 middleschool     Seoul     127.  37.6
3  2082 highschool       Seoul     127.  37.6
4  2082 elementaryschool Seoul     127.  37.6
5  2082 elementaryschool Seoul     127.  37.6
6  2082 elementaryschool Seoul     127.  37.6
  • What is the crs for the points themselves?
  • They are in longitude/latitude (WGS 84): “EPSG:4326”

Creating the object

  • We have to specify the CRS based on what the POINTS represent, not what we want it to eventually be
    • Then we can project it
Code
# create the object
df <- vect(df, geom = c("lon", "lat"), crs = "EPSG:4326")
# now project it
df <- project(df, crs(grids))

Compare the output

original object class : SpatVector geometry : points dimensions : 1459, 3 (geometries, attributes) extent : 126.9018, 127.1308, 37.46144, 37.65323 (xmin, xmax, ymin, ymax) coord. ref. : lon/lat WGS 84 (EPSG:4326)

after projection class : SpatVector geometry : points dimensions : 1459, 3 (geometries, attributes) extent : 947164.1, 967361.8, 1940349, 1961613 (xmin, xmax, ymin, ymax) coord. ref. : Korea 2000 / Unified CS (EPSG:5179)

Distances

  • We now have our grids (we’ll get rid of zero pop in a moment0)
  • And we have points in the same CRS
Code
grids <- grids |>
  filter(!is.na(pop))
# create distance matrix for PRIMARY schools
distances <- distance(grids, df |> filter(fclass=="elementaryschool"))
dim(distances)
[1] 45849   555
Code
head(distances)
         [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]     [,8]
[1,] 11968.57 11934.85 11951.80 12043.08 12024.93 12357.01 12343.99 12320.89
[2,] 11978.48 11944.58 11961.33 12053.67 12035.60 12428.94 12415.88 12392.61
[3,] 11989.93 11955.83 11972.36 12065.83 12047.85 12506.53 12493.42 12469.98
[4,] 12002.19 11967.90 11984.22 12078.81 12060.92 12584.43 12571.29 12547.66
[5,] 11879.10 11845.17 11861.90 11954.37 11936.31 12365.90 12352.78 12329.29
[6,] 11890.64 11856.51 11873.03 11966.63 11948.66 12443.88 12430.72 12407.06
         [,9]    [,10]    [,11]    [,12]    [,13]    [,14]    [,15]    [,16]
[1,] 12338.70 12355.75 12407.23 13618.28 13490.33 13669.29 13672.48 13660.10
[2,] 12410.40 12427.48 12479.00 13688.95 13560.60 13739.49 13742.80 13730.62
[3,] 12487.75 12504.86 12556.42 13765.17 13636.41 13815.22 13818.65 13806.69
[4,] 12565.42 12582.55 12634.16 13841.69 13712.52 13891.25 13894.80 13883.05
[5,] 12347.07 12364.18 12415.75 13624.25 13495.41 13674.21 13677.66 13665.74
[6,] 12424.81 12441.95 12493.56 13700.83 13571.57 13750.29 13753.87 13742.16
        [,17]    [,18]    [,19]    [,20]    [,21]    [,22]    [,23]    [,24]
[1,] 13629.23 13222.72 13239.86 13273.02 13323.99 19346.24 19400.15 19440.78
[2,] 13699.88 13290.56 13307.60 13340.83 13391.86 19405.09 19458.51 19499.56
[3,] 13776.07 13363.79 13380.71 13414.02 13465.11 19468.62 19521.51 19563.00
[4,] 13852.57 13437.37 13454.16 13487.55 13538.70 19532.46 19584.81 19626.75
[5,] 13635.14 13222.48 13239.38 13272.70 13323.80 19327.84 19380.82 19422.24
[6,] 13711.70 13296.08 13312.87 13346.26 13397.42 19391.63 19444.07 19485.93
        [,25]    [,26]    [,27]    [,28]    [,29]    [,30]    [,31]    [,32]
[1,] 19444.34 21972.68 22057.93 22059.73 21969.32 22031.99 22079.46 22079.72
[2,] 19503.12 22017.12 22102.15 22104.30 22013.38 22075.54 22123.08 22123.39
[3,] 19566.57 22065.20 22149.99 22152.52 22061.07 22122.68 22170.29 22170.65
[4,] 19630.32 22113.62 22198.17 22201.09 22109.10 22170.17 22217.85 22218.25
[5,] 19425.80 21929.39 22014.29 22016.65 21925.44 21987.31 22034.88 22035.22
[6,] 19489.51 21977.66 22062.32 22065.06 21973.31 22034.63 22082.28 22082.66
        [,33]    [,34]    [,35]    [,36]    [,37]    [,38]    [,39]    [,40]
[1,] 22080.92 22082.52 22083.59 19811.11 19927.83 20019.63 20008.31 19998.55
[2,] 22124.69 22126.60 22127.85 19804.10 19922.35 20014.65 19980.78 19971.18
[3,] 22172.05 22174.30 22175.73 19797.60 19917.38 20010.16 19953.70 19944.28
[4,] 22219.76 22222.34 22223.96 19796.38 19916.46 20009.34 19948.47 19939.08
[5,] 22036.57 22038.67 22040.01 19704.33 19822.49 19914.76 19884.60 19874.95
[6,] 22084.12 22086.55 22088.08 19697.79 19817.49 19910.25 19857.39 19847.92
        [,41]    [,42]    [,43]    [,44]    [,45]    [,46]    [,47]    [,48]
[1,] 19872.82 22911.63 22886.40 22967.58 22964.82 22976.38 22985.17 22962.55
[2,] 19845.03 22935.00 22909.58 22990.52 22987.82 22999.57 23008.42 22985.99
[3,] 19817.71 22960.50 22934.87 23015.56 23012.92 23024.87 23033.79 23011.56
[4,] 19812.42 22986.40 22960.57 23041.01 23038.43 23050.58 23059.56 23037.53
[5,] 19748.92 22838.26 22812.79 22893.67 22890.98 22902.78 22911.65 22889.27
[6,] 19721.47 22863.87 22838.19 22918.82 22916.19 22928.19 22937.12 22914.95
        [,49]    [,50]    [,51]    [,52]    [,53]    [,54]    [,55]    [,56]
[1,] 22890.23 22901.58 17404.38 17416.36 17437.71 17455.23 17468.77 17451.97
[2,] 22913.49 22924.94 17375.94 17387.79 17409.31 17426.68 17440.24 17423.62
[3,] 22938.88 22950.44 17348.03 17359.75 17381.44 17398.65 17412.23 17395.79
[4,] 22964.67 22976.34 17342.64 17354.33 17376.05 17393.23 17406.82 17390.41
[5,] 22816.73 22828.21 17280.02 17291.90 17313.37 17330.79 17344.34 17327.67
[6,] 22842.22 22853.81 17251.95 17263.71 17285.35 17302.60 17316.18 17299.68
        [,57]    [,58]    [,59]    [,60]    [,61]    [,62]    [,63]    [,64]
[1,] 17462.38 17404.38 17321.17 17384.40 17349.31 18038.02 20201.81 20360.15
[2,] 17434.14 17375.94 17292.86 17356.06 17321.13 18028.18 20182.08 20340.44
[3,] 17406.43 17348.03 17265.07 17328.25 17293.48 18018.89 20162.83 20321.22
[4,] 17401.07 17342.64 17259.71 17322.88 17288.14 18017.14 20159.12 20317.51
[5,] 17338.16 17280.02 17196.89 17260.10 17225.12 17928.64 20084.01 20242.37
[6,] 17310.29 17251.95 17168.96 17232.14 17197.32 17919.30 20064.66 20223.04
        [,65]    [,66]    [,67]    [,68]    [,69]    [,70]    [,71]    [,72]
[1,] 20444.95 20354.77 20391.18 20704.47 20703.06 20598.24 21031.96 20959.62
[2,] 20425.11 20334.90 20371.60 20681.66 20680.81 20576.02 21012.12 20940.09
[3,] 20405.74 20315.50 20352.48 20659.32 20659.02 20554.26 20992.73 20921.01
[4,] 20402.01 20311.77 20348.80 20655.00 20654.81 20550.06 20989.00 20917.34
[5,] 20327.06 20236.86 20273.50 20584.26 20583.28 20478.48 20914.07 20841.97
[6,] 20307.60 20217.37 20254.29 20561.81 20561.38 20456.61 20894.59 20822.81
        [,73]    [,74]    [,75]    [,76]    [,77]    [,78]    [,79]    [,80]
[1,] 21186.36 21157.93 21152.99 21110.16 21176.03 21253.93 21157.93 21978.77
[2,] 21164.31 21140.89 21135.95 21093.00 21158.35 21236.57 21140.89 21953.67
[3,] 21142.71 21124.32 21119.36 21076.30 21141.13 21219.68 21124.32 21929.01
[4,] 21138.54 21121.14 21116.17 21073.09 21137.81 21216.43 21121.14 21924.23
[5,] 21066.73 21042.32 21037.38 20994.45 21059.89 21138.06 21042.32 21856.83
[6,] 21045.03 21025.67 21020.71 20977.68 21042.59 21121.08 21025.67 21832.06
        [,81]    [,82]    [,83]    [,84]    [,85]    [,86]    [,87]    [,88]
[1,] 22103.33 21978.77 25777.42 25816.74 25876.62 16843.58 16866.14 9094.441
[2,] 22078.16 21953.67 25779.38 25818.41 25878.41 16820.45 16843.18 9073.283
[3,] 22053.42 21929.01 25781.85 25820.57 25880.70 16797.89 16820.78 9053.180
[4,] 22048.63 21924.23 25784.71 25823.12 25883.39 16793.54 16816.47 9049.374
[5,] 21981.34 21856.83 25679.40 25718.43 25778.43 16723.11 16745.80 8975.458
[6,] 21956.49 21832.06 25681.89 25720.60 25780.74 16700.42 16723.28 8955.136
        [,89]    [,90]    [,91]    [,92]    [,93]    [,94]    [,95]    [,96]
[1,] 9094.672 9061.502 9063.281 8611.989 8658.008 8644.331 8550.999 8543.729
[2,] 9073.711 9040.523 9042.101 8594.864 8641.421 8627.854 8534.329 8527.092
[3,] 9053.805 9020.603 9021.980 8578.870 8625.962 8612.507 8518.801 8511.598
[4,] 9050.038 9016.833 9018.171 8575.877 8623.072 8609.640 8515.899 8508.703
[5,] 8975.844 8942.660 8944.281 8496.261 8542.729 8529.143 8435.649 8428.407
[6,] 8955.721 8922.521 8923.939 8480.081 8527.090 8513.618 8419.939 8412.731
        [,97]    [,98]    [,99]   [,100]   [,101]   [,102]   [,103]   [,104]
[1,] 19394.17 19390.30 19318.49 19301.88 22248.48 22332.49 21805.18 21751.37
[2,] 19358.54 19354.75 19283.39 19266.71 22227.80 22311.94 21773.43 21719.84
[3,] 19323.37 19319.65 19248.75 19232.00 22207.56 22291.82 21742.08 21688.73
[4,] 19316.54 19312.85 19242.03 19225.27 22203.65 22287.94 21736.00 21682.69
[5,] 19265.05 19261.23 19189.70 19173.05 22129.93 22214.04 21678.56 21624.90
[6,] 19229.70 19225.96 19154.89 19138.17 22109.59 22193.83 21647.08 21593.64
       [,105]   [,106]   [,107]   [,108]   [,109]   [,110]   [,111]   [,112]
[1,] 21226.20 22406.23 22529.98 22430.05 22515.19 22597.53 22422.73 24157.57
[2,] 21193.64 22378.55 22500.63 22401.23 22480.75 22563.64 22388.53 24126.29
[3,] 21161.51 22351.28 22471.69 22372.82 22446.71 22530.14 22354.73 24095.39
[4,] 21155.28 22346.00 22466.08 22367.32 22440.10 22523.64 22348.17 24089.39
[5,] 21099.04 22282.41 22405.00 22305.43 22386.83 22469.51 22294.52 24031.27
[6,] 21066.77 22255.03 22375.93 22276.90 22352.64 22435.87 22260.57 24000.24
       [,113]   [,114]   [,115]   [,116]   [,117]   [,118]   [,119]   [,120]
[1,] 24002.76 19083.56 18644.14 18675.96 18685.24 18694.07 18817.53 18741.13
[2,] 23971.23 19116.49 18623.97 18655.04 18664.30 18673.14 18797.06 18721.34
[3,] 23940.07 19152.30 18604.31 18634.62 18643.88 18652.73 18777.10 18702.06
[4,] 23934.03 19188.57 18600.53 18630.69 18639.95 18648.79 18773.26 18698.35
[5,] 23876.29 19023.07 18525.98 18557.21 18566.48 18575.31 18699.13 18623.28
[6,] 23845.01 19059.06 18506.22 18536.69 18545.95 18554.79 18679.07 18603.90
       [,121]   [,122]   [,123]   [,124]   [,125]   [,126]   [,127]   [,128]
[1,] 18709.64 18484.76 18544.43 18546.75 18484.76 18545.46 18547.36 18525.49
[2,] 18689.35 18465.53 18524.94 18527.38 18465.53 18529.78 18531.69 18510.11
[3,] 18669.57 18446.83 18505.97 18508.53 18446.83 18514.63 18516.54 18495.26
[4,] 18665.76 18443.23 18502.32 18504.91 18443.23 18511.73 18513.64 18492.41
[5,] 18591.39 18367.36 18426.82 18429.23 18367.36 18430.98 18432.89 18411.27
[6,] 18571.50 18348.55 18407.74 18410.28 18348.55 18415.75 18417.66 18396.33
       [,129]   [,130]   [,131]   [,132]   [,133]   [,134]   [,135]   [,136]
[1,] 17928.57 18000.23 17939.04 14805.70 14826.03 25188.13 25181.53 25175.44
[2,] 17915.00 17986.87 17926.33 14857.74 14878.10 25220.30 25213.58 25207.39
[3,] 17901.98 17974.06 17914.16 14914.10 14934.48 25255.18 25248.35 25242.06
[4,] 17899.49 17971.62 17911.85 14970.91 14991.32 25290.42 25283.47 25277.07
[5,] 17815.89 17887.73 17827.11 14775.08 14795.46 25126.54 25119.78 25113.55
[6,] 17802.80 17874.85 17814.88 14831.75 14852.16 25161.56 25154.68 25148.35
       [,137]   [,138]   [,139]   [,140]   [,141]   [,142]   [,143]   [,144]
[1,] 25174.92 25182.68 25230.48 25236.06 25248.32 25278.85 25291.97 25188.13
[2,] 25206.86 25214.62 25262.38 25267.95 25280.21 25310.80 25324.13 25220.30
[3,] 25241.51 25249.26 25296.99 25302.56 25314.80 25345.47 25359.01 25255.18
[4,] 25276.51 25284.26 25331.94 25337.51 25349.74 25380.48 25394.24 25290.42
[5,] 25113.01 25120.77 25168.52 25174.09 25186.34 25216.97 25230.37 25126.54
[6,] 25147.79 25155.54 25203.26 25208.82 25221.07 25251.76 25265.38 25161.56
       [,145]   [,146]   [,147]   [,148]   [,149]   [,150]   [,151]   [,152]
[1,] 25626.46 25609.25 25594.65 25588.63 25577.14 25603.96 25728.56 25547.89
[2,] 25657.99 25640.79 25625.94 25619.83 25608.14 25634.76 25759.96 25577.32
[3,] 25692.19 25675.01 25659.90 25653.67 25641.77 25668.19 25794.03 25609.27
[4,] 25726.74 25709.57 25694.20 25687.86 25675.75 25701.95 25828.44 25641.57
[5,] 25563.98 25546.79 25531.84 25525.69 25513.92 25540.47 25665.90 25482.52
[6,] 25598.31 25581.13 25565.92 25559.66 25547.68 25574.02 25700.10 25514.59
       [,153]   [,154]   [,155]   [,156]   [,157]   [,158]   [,159]   [,160]
[1,] 25516.16 25418.08 22333.72 26328.73 26286.64 14723.63 14625.01 14688.01
[2,] 25545.57 25447.44 22299.77 26358.93 26317.14 14724.05 14625.43 14688.01
[3,] 25577.50 25479.33 22266.22 26391.71 26350.23 14725.14 14626.55 14688.33
[4,] 25609.79 25511.57 22259.71 26424.83 26383.65 14726.92 14628.35 14689.34
[5,] 25450.76 25352.63 22205.67 26264.42 26222.73 14624.05 14525.43 14588.01
[6,] 25482.82 25384.63 22171.97 26297.32 26255.94 14625.16 14526.56 14588.34
       [,161]   [,162]   [,163]   [,164]   [,165]   [,166]   [,167]   [,168]
[1,] 14716.89 14664.67 14684.82 14804.41 14803.35 14911.77 14896.71 14873.74
[2,] 14716.76 14664.29 14683.94 14803.29 14802.60 14911.77 14896.71 14873.75
[3,] 14716.81 14664.29 14683.72 14802.86 14802.48 14912.09 14897.13 14874.22
[4,] 14717.41 14664.60 14683.74 14802.85 14802.53 14913.07 14898.22 14875.36
[5,] 14616.76 14564.29 14583.94 14703.30 14702.60 14811.77 14796.71 14773.75
[6,] 14616.81 14564.29 14583.72 14702.86 14702.48 14812.09 14797.13 14774.22
       [,169]   [,170]   [,171]   [,172]   [,173]   [,174]   [,175]   [,176]
[1,] 14756.66 5239.312 5259.967 5155.908 5283.385 5270.723 15035.46 14970.47
[2,] 14756.67 5201.292 5224.011 5117.709 5243.504 5232.209 15084.80 15019.88
[3,] 14757.08 5164.929 5189.732 5081.192 5205.238 5195.335 15138.25 15073.44
[4,] 14758.18 5158.017 5183.230 5074.253 5197.950 5188.321 15192.18 15127.46
[5,] 14656.67 5108.603 5130.502 5025.091 5151.604 5139.726 15000.23 14935.38
[6,] 14657.09 5071.575 5095.595 4987.896 5112.651 5102.183 15053.99 14989.23
       [,177]   [,178]   [,179]   [,180]   [,181]   [,182]   [,183]   [,184]
[1,] 14962.87 14944.23 14938.18 14931.10 14917.86 14911.05 14919.55 14933.11
[2,] 15012.30 14993.66 14987.61 14980.51 14967.24 14960.28 14968.31 14981.89
[3,] 15065.86 15047.23 15041.16 15034.05 15020.75 15013.63 15021.17 15034.76
[4,] 15119.89 15101.27 15095.19 15088.07 15074.73 15067.45 15074.50 15088.10
[5,] 14927.80 14909.16 14903.10 14896.00 14882.71 14875.64 14883.37 14896.95
[6,] 14981.66 14963.04 14956.96 14949.84 14936.52 14929.29 14936.52 14950.12
       [,185]   [,186]   [,187]   [,188]   [,189]   [,190]   [,191]   [,192]
[1,] 14983.34 15056.63 5230.262 5228.207 5362.685 5407.448 5419.561 5404.538
[2,] 15032.12 15105.57 5183.967 5181.742 5316.864 5362.730 5375.408 5360.760
[3,] 15084.99 15158.60 5139.201 5136.804 5272.542 5319.517 5332.764 5318.503
[4,] 15138.34 15212.11 5130.632 5128.201 5264.056 5311.249 5324.607 5310.423
[5,] 14947.18 15020.73 5095.140 5093.005 5227.795 5273.100 5285.497 5270.665
[6,] 15000.35 15074.07 5049.587 5047.276 5182.711 5229.146 5242.122 5227.679
       [,193]   [,194]   [,195]   [,196]   [,197]   [,198]   [,199]   [,200]
[1,] 5223.716 15192.99 15167.68 15141.74 15230.98 15351.23 15222.52 14836.94
[2,] 5179.173 15240.82 15215.37 15189.18 15278.23 15398.65 15270.37 14890.96
[3,] 5136.192 15292.66 15267.08 15240.61 15329.46 15450.07 15322.25 14949.42
[4,] 5127.976 15344.98 15319.27 15292.52 15381.17 15501.96 15374.59 15008.32
[5,] 5089.449 15155.25 15129.72 15103.36 15192.29 15312.83 15184.82 14809.79
[6,] 5045.703 15207.38 15181.73 15155.08 15243.81 15364.53 15236.99 14868.57
       [,201]   [,202]   [,203]   [,204]   [,205]   [,206]   [,207]   [,208]
[1,] 14817.99 14808.09 14809.50 14847.97 14891.88 14920.25 14925.10 14925.41
[2,] 14872.01 14862.09 14863.32 14901.70 14945.66 14974.10 14979.11 14979.45
[3,] 14930.46 14920.53 14921.57 14959.85 15003.88 15032.38 15037.56 15037.94
[4,] 14989.36 14979.42 14980.27 15018.44 15062.53 15091.11 15096.45 15096.86
[5,] 14790.83 14780.90 14781.99 14820.30 14864.31 14892.80 14897.93 14898.29
[6,] 14849.61 14839.66 14840.57 14878.77 14922.84 14951.40 14956.70 14957.09
       [,209]   [,210]   [,211]   [,212]   [,213]   [,214]   [,215]   [,216]
[1,] 17981.96 17971.53 18007.62 18071.58 18020.58 17826.25 17806.80 17804.39
[2,] 17967.59 17947.35 17983.19 18047.55 17996.70 17808.21 17788.72 17786.03
[3,] 17953.77 17923.69 17959.28 18024.04 17973.34 17790.72 17771.19 17768.22
[4,] 17951.13 17919.13 17954.67 18019.51 17968.83 17787.36 17767.82 17764.80
[5,] 17868.60 17850.27 17886.17 17950.43 17899.54 17709.81 17690.33 17687.69
[6,] 17854.70 17826.48 17862.13 17926.79 17876.05 17692.22 17672.70 17669.78
       [,217]   [,218]   [,219]   [,220]   [,221]   [,222]   [,223]   [,224]
[1,] 17812.76 17820.76 17862.92 17869.33 17878.63 17879.20 17842.32 17839.58
[2,] 17794.07 17802.10 17844.28 17850.82 17860.26 17861.10 17824.25 17821.56
[3,] 17775.92 17783.97 17826.19 17832.84 17842.43 17843.54 17806.71 17804.09
[4,] 17772.43 17780.49 17822.71 17829.39 17839.01 17840.18 17803.35 17800.74
[5,] 17695.79 17703.81 17745.99 17752.50 17761.92 17762.71 17725.85 17723.16
[6,] 17677.54 17685.59 17727.80 17734.43 17743.99 17745.06 17708.22 17705.59
       [,225]   [,226]   [,227]   [,228]   [,229]   [,230]   [,231]   [,232]
[1,] 17783.56 17971.50 17932.34 17859.64 17313.16 17443.55 17252.23 18053.29
[2,] 17768.61 17956.33 17916.12 17844.07 17290.07 17420.91 17229.68 18028.66
[3,] 17754.21 17941.70 17900.45 17829.06 17267.54 17398.83 17207.69 18004.56
[4,] 17751.46 17938.91 17897.45 17826.19 17263.19 17394.57 17203.45 17999.91
[5,] 17669.70 17857.45 17817.41 17745.26 17192.72 17323.46 17132.21 17931.69
[6,] 17655.22 17842.74 17801.65 17730.16 17170.06 17301.25 17110.09 17907.46
       [,233]   [,234]   [,235]   [,236]   [,237]   [,238]   [,239]   [,240]
[1,] 18070.53 18167.89 18074.83 18011.01 17254.03 17212.39 17148.29 17067.69
[2,] 18045.86 18143.67 18050.80 17986.57 17234.18 17193.41 17129.22 17048.93
[3,] 18021.71 18119.98 18027.29 17962.66 17214.88 17174.99 17110.71 17030.73
[4,] 18017.05 18115.41 18022.76 17958.05 17211.17 17171.45 17107.16 17027.24
[5,] 17948.90 18046.60 17953.68 17889.56 17136.12 17095.18 17031.01 16950.66
[6,] 17924.62 18022.78 17930.05 17865.52 17116.72 17076.66 17012.39 16932.36
       [,241]   [,242]   [,243]   [,244]   [,245]   [,246]   [,247]   [,248]
[1,] 17153.10 17213.94 17137.02 16883.31 16848.52 18506.41 23482.18 23486.34
[2,] 17134.09 17195.02 17118.38 16858.16 16823.05 18483.67 23485.68 23489.84
[3,] 17115.65 17176.66 17100.31 16833.56 16798.14 18461.44 23489.84 23494.00
[4,] 17112.11 17173.14 17096.85 16828.82 16793.33 18457.15 23494.44 23498.59
[5,] 17035.87 17096.79 17020.09 16761.32 16726.30 18386.24 23385.75 23389.92
[6,] 17017.32 17078.32 17001.92 16736.58 16701.24 18363.89 23389.94 23394.10
       [,249]   [,250]   [,251]   [,252]   [,253]   [,254]   [,255]   [,256]
[1,] 23470.48 23547.57 23547.91 23546.35 23554.57 23558.53 23568.44 23551.58
[2,] 23473.67 23550.97 23551.27 23549.69 23557.90 23561.88 23571.89 23555.04
[3,] 23477.51 23555.04 23555.29 23553.68 23561.89 23565.90 23576.00 23559.16
[4,] 23481.77 23559.53 23559.74 23558.10 23566.30 23570.33 23580.54 23563.71
[5,] 23373.73 23451.05 23451.35 23449.76 23457.98 23461.96 23471.97 23455.11
[6,] 23377.59 23455.13 23455.39 23453.77 23461.98 23465.99 23476.10 23459.26
       [,257]   [,258]   [,259]   [,260]   [,261]   [,262]   [,263]   [,264]
[1,] 23530.90 23517.27 23483.86 23489.82 25288.70 25321.38 25392.62 25409.07
[2,] 23534.35 23520.47 23487.08 23493.29 25322.46 25355.06 25425.90 25442.35
[3,] 23538.46 23524.31 23490.97 23497.44 25359.06 25391.58 25461.99 25478.45
[4,] 23542.99 23528.59 23495.27 23502.02 25396.01 25428.45 25498.42 25514.88
[5,] 23434.42 23420.53 23387.15 23393.37 25229.36 25261.93 25332.60 25349.05
[6,] 23438.55 23424.40 23391.05 23397.54 25266.10 25298.59 25368.82 25385.28
       [,265]   [,266]   [,267]   [,268]   [,269]   [,270]   [,271]   [,272]
[1,] 25467.20 25475.82 25478.94 25488.40 25518.25 25535.91 25546.52 25550.57
[2,] 25500.50 25509.07 25512.17 25521.57 25551.28 25569.02 25579.68 25583.75
[3,] 25536.60 25545.12 25548.20 25557.53 25587.09 25604.92 25615.63 25619.72
[4,] 25573.04 25581.50 25584.56 25593.84 25623.25 25641.16 25651.92 25656.04
[5,] 25407.20 25415.75 25418.85 25428.22 25457.87 25475.65 25486.32 25490.40
[6,] 25443.44 25451.93 25455.00 25464.32 25493.82 25511.68 25522.41 25526.51
       [,273]   [,274]   [,275]   [,276]   [,277]   [,278]   [,279]   [,280]
[1,] 25551.81 25550.47 25549.22 25459.11 25414.10 25884.13 25821.94 25813.96
[2,] 25585.00 25583.81 25582.60 25492.56 25447.69 25913.26 25851.09 25842.97
[3,] 25620.99 25619.95 25618.79 25528.82 25484.10 25944.89 25882.73 25874.49
[4,] 25657.31 25656.44 25655.32 25565.43 25520.85 25976.86 25914.72 25906.35
[5,] 25491.66 25490.53 25489.34 25399.32 25354.51 25818.35 25756.19 25748.03
[6,] 25527.78 25526.81 25525.66 25435.72 25391.05 25850.10 25787.95 25779.66
       [,281]   [,282]   [,283]   [,284]   [,285]   [,286]   [,287]   [,288]
[1,] 25680.15 25666.43 25740.96 25710.22 25765.06 25784.11 25853.89 25873.37
[2,] 25709.10 25695.20 25769.61 25738.63 25793.41 25812.44 25882.40 25902.04
[3,] 25740.53 25726.45 25800.72 25769.49 25824.21 25843.22 25913.36 25933.18
[4,] 25772.32 25758.05 25832.18 25800.70 25855.35 25874.35 25944.68 25964.67
[5,] 25614.13 25600.17 25674.53 25643.47 25698.23 25717.26 25787.28 25806.97
[6,] 25645.68 25631.53 25705.76 25674.44 25729.14 25748.15 25818.35 25838.23
       [,289]   [,290]   [,291]   [,292]   [,293]   [,294]   [,295]   [,296]
[1,] 25900.29 25923.69 25917.87 25896.53 25884.13 24103.42 24106.14 24209.90
[2,] 25928.94 25952.69 25946.91 25925.65 25913.26 24124.67 24127.37 24231.09
[3,] 25960.06 25984.19 25978.45 25957.27 25944.89 24147.88 24150.57 24254.23
[4,] 25991.53 26016.04 26010.33 25989.24 25976.86 24171.48 24174.15 24277.76
[5,] 25833.87 25857.75 25851.97 25830.74 25818.35 24027.36 24030.06 24133.76
[6,] 25865.10 25889.36 25883.63 25862.48 25850.10 24050.67 24053.35 24157.00
       [,297]   [,298]   [,299]   [,300]   [,301]   [,302]   [,303]   [,304]
[1,] 24231.05 24228.04 24182.92 25186.48 25179.43 22702.89 22696.67 22718.62
[2,] 24252.64 24249.64 24204.56 25216.82 25209.65 22696.91 22690.58 22712.32
[3,] 24276.20 24273.22 24228.17 25249.77 25242.46 22691.37 22684.94 22706.47
[4,] 24300.16 24297.19 24252.18 25283.06 25275.62 22690.34 22683.88 22705.38
[5,] 24155.42 24152.42 24107.35 25122.37 25115.15 22597.08 22590.75 22612.51
[6,] 24179.08 24176.10 24131.06 25155.43 25148.08 22591.51 22585.08 22606.63
       [,305]   [,306]   [,307]   [,308]   [,309]   [,310]   [,311]   [,312]
[1,] 22723.88 22757.37 22707.72 15212.91 15238.14 15267.46 15269.66 15257.31
[2,] 22717.63 22751.45 22701.74 15208.68 15233.15 15262.49 15264.78 15252.52
[3,] 22711.82 22745.97 22696.19 15205.11 15228.81 15258.17 15260.56 15248.38
[4,] 22710.74 22744.95 22695.16 15204.49 15228.04 15257.40 15259.81 15247.64
[5,] 22617.81 22651.61 22601.90 15108.76 15133.26 15162.60 15164.89 15152.62
[6,] 22611.98 22646.11 22596.33 15105.17 15128.89 15158.25 15160.63 15148.45
       [,313]   [,314]   [,315]   [,316]   [,317]   [,318]   [,319]   [,320]
[1,] 15256.42 15266.78 15212.91 14930.74 14959.64 14951.86 14928.39 14918.82
[2,] 15251.68 15262.34 15208.68 14930.74 14959.44 14951.52 14927.87 14918.13
[3,] 15247.59 15258.56 15205.11 14931.07 14959.45 14951.52 14927.84 14918.04
[4,] 15246.87 15257.90 15204.49 14932.08 14959.93 14951.85 14928.01 14918.12
[5,] 15151.78 15162.43 15108.76 14830.74 14859.44 14851.52 14827.87 14818.13
[6,] 15147.67 15158.62 15105.17 14831.08 14859.45 14851.52 14827.84 14818.04
       [,321]   [,322]   [,323]   [,324]   [,325]   [,326]   [,327]   [,328]
[1,] 14884.65 14890.97 14868.48 14870.39 14872.26 14884.45 14904.45 14950.01
[2,] 14883.85 14890.09 14867.36 14869.20 14870.99 14882.91 14902.87 14948.23
[3,] 14883.69 14889.86 14866.92 14868.67 14870.39 14882.05 14901.95 14947.12
[4,] 14883.72 14889.87 14866.92 14868.65 14870.35 14881.96 14901.85 14946.98
[5,] 14783.85 14790.09 14767.37 14769.20 14770.99 14782.92 14802.87 14848.24
[6,] 14783.69 14789.86 14766.92 14768.67 14770.39 14782.05 14801.96 14847.12
       [,329]   [,330]   [,331]   [,332]   [,333]   [,334]   [,335]   [,336]
[1,] 14964.23 14997.13 15029.67 15053.01 15093.61 15129.86 15150.80 15152.99
[2,] 14962.32 14995.56 15027.96 15051.14 15091.60 15127.65 15148.62 15151.14
[3,] 14961.07 14994.66 15026.92 15049.94 15090.25 15126.09 15147.10 15149.94
[4,] 14960.91 14994.56 15026.79 15049.78 15090.06 15125.87 15146.88 15149.79
[5,] 14862.33 14895.57 14927.97 14951.15 14991.61 15027.66 15048.64 15051.15
[6,] 14861.08 14894.66 14926.92 14949.94 14990.25 15026.10 15047.11 15049.95
       [,337]   [,338]   [,339]   [,340]   [,341]   [,342]   [,343]   [,344]
[1,] 15138.53 15132.27 15032.47 15024.30 15027.81 15039.53 15042.06 15040.38
[2,] 15136.74 15130.51 15031.16 15023.03 15026.78 15038.72 15041.48 15039.83
[3,] 15135.61 15129.41 15030.51 15022.42 15026.43 15038.54 15041.43 15039.79
[4,] 15135.47 15129.27 15030.46 15022.38 15026.42 15038.57 15041.56 15039.94
[5,] 15036.75 15030.52 14931.16 14923.04 14926.79 14938.72 14941.48 14939.83
[6,] 15035.61 15029.41 14930.51 14922.42 14926.43 14938.54 14941.43 14939.79
       [,345]   [,346]   [,347]   [,348]   [,349]   [,350]   [,351]   [,352]
[1,] 15038.89 15019.43 15016.99 15016.18 15008.61 15001.66 14957.06 14950.68
[2,] 15038.36 15019.03 15016.64 15015.89 15008.58 15001.64 14957.05 14950.67
[3,] 15038.33 15019.03 15016.64 15015.89 15008.75 15001.83 14957.24 14950.88
[4,] 15038.50 15019.30 15016.96 15016.27 15009.54 15002.67 14958.09 14951.74
[5,] 14938.36 14919.03 14916.64 14915.89 14908.58 14901.64 14857.05 14850.67
[6,] 14938.33 14919.03 14916.64 14915.89 14908.75 14901.83 14857.25 14850.88
       [,353]   [,354]   [,355]   [,356]   [,357]   [,358]   [,359]   [,360]
[1,] 14930.74 25625.32 25539.09 25620.03 25625.32 16532.20 16560.67 16666.05
[2,] 14930.74 25660.16 25573.75 25654.50 25660.16 16507.78 16536.12 16642.43
[3,] 14931.07 25697.92 25611.31 25691.86 25697.92 16483.93 16512.14 16619.39
[4,] 14932.08 25736.01 25649.21 25729.55 25736.01 16479.33 16507.52 16614.95
[5,] 14830.74 25567.52 25481.03 25561.70 25567.52 16410.75 16439.13 16545.21
[6,] 14831.08 25605.42 25518.73 25599.19 25605.42 16386.76 16415.01 16522.03
       [,361]   [,362]   [,363]   [,364]   [,365]   [,366]   [,367]   [,368]
[1,] 16658.67 16676.28 16601.08 16439.19 25036.42 25127.40 25212.61 25251.46
[2,] 16635.21 16652.98 16577.69 16414.54 25058.33 25149.24 25234.63 25273.57
[3,] 16612.32 16630.26 16554.86 16390.46 25082.24 25173.06 25258.64 25297.69
[4,] 16607.92 16625.88 16550.47 16385.82 25106.52 25197.26 25283.03 25322.17
[5,] 16537.95 16555.68 16480.41 16317.57 24961.20 25052.09 25137.52 25176.49
[6,] 16514.93 16532.82 16457.45 16293.35 24985.20 25076.00 25161.62 25200.69
       [,369]   [,370]   [,371]   [,372]   [,373]   [,374]   [,375]   [,376]
[1,] 25098.57 24640.01 24635.28 24833.63 24800.87 24664.80 25344.67 25334.15
[2,] 25120.78 24666.64 24661.87 24860.35 24827.77 24691.51 25368.39 25357.60
[3,] 25145.00 24695.62 24690.79 24889.40 24857.02 24720.56 25394.22 25383.16
[4,] 25169.60 24724.96 24720.07 24918.82 24886.64 24749.97 25420.42 25409.08
[5,] 25023.72 24570.89 24566.10 24764.62 24732.10 24595.78 25271.75 25260.89
[6,] 25048.04 24599.98 24595.13 24793.79 24761.47 24624.94 25297.68 25286.54
       [,377]   [,378]   [,379]   [,380]   [,381]   [,382]   [,383]   [,384]
[1,] 25327.36 25460.25 21718.29 21805.18 21751.37 21662.43 11804.06 11797.13
[2,] 25350.77 25483.68 21686.13 21773.43 21719.84 21630.52 11862.89 11855.93
[3,] 25376.28 25509.20 21654.39 21742.08 21688.73 21599.03 11926.58 11919.60
[4,] 25402.15 25535.10 21648.23 21736.00 21682.69 21592.92 11990.77 11983.76
[5,] 25254.04 25386.96 21591.40 21678.56 21624.90 21535.70 11785.76 11778.78
[6,] 25279.65 25412.58 21559.51 21647.08 21593.64 21504.07 11849.87 11842.86
       [,385]   [,386]   [,387]   [,388]   [,389]   [,390]   [,391]   [,392]
[1,] 11903.97 11866.49 13353.14 13343.29 13322.83 13304.92 13346.92 13403.67
[2,] 11962.18 11925.23 13396.44 13386.46 13365.88 13346.94 13388.87 13445.75
[3,] 12025.20 11988.82 13443.51 13433.41 13412.70 13392.66 13434.52 13491.54
[4,] 12088.72 12052.91 13491.17 13480.93 13460.10 13438.96 13480.75 13537.91
[5,] 11884.50 11848.02 13308.14 13298.09 13277.45 13257.93 13299.82 13356.78
[6,] 11947.93 11912.02 13355.53 13345.35 13324.57 13303.95 13345.77 13402.87
       [,393]   [,394]   [,395]   [,396]   [,397]   [,398]   [,399]   [,400]
[1,] 13423.36 13545.91 13526.79 13531.91 13426.32 13418.20 13133.02 13091.12
[2,] 13465.47 13588.54 13569.59 13574.76 13469.75 13461.92 13177.42 13135.65
[3,] 13511.28 13634.91 13616.14 13621.35 13516.96 13509.45 13225.68 13184.05
[4,] 13557.67 13681.85 13663.26 13668.52 13564.74 13557.55 13274.53 13233.04
[5,] 13376.51 13499.87 13481.01 13486.20 13381.52 13373.87 13089.76 13048.07
[6,] 13422.62 13546.54 13527.86 13533.10 13429.04 13421.71 13138.35 13096.80
       [,401]   [,402]   [,403]   [,404]   [,405]   [,406]   [,407]   [,408]
[1,] 13130.84 13148.33 13216.70 13291.11 13186.72 13256.22 13215.26 13269.81
[2,] 13174.21 13191.58 13259.64 13334.62 13231.02 13300.78 13259.13 13313.17
[3,] 13221.37 13238.62 13306.34 13381.93 13279.18 13349.22 13306.82 13360.32
[4,] 13269.13 13286.25 13353.62 13429.82 13327.92 13398.22 13355.09 13408.05
[5,] 13085.96 13103.26 13171.14 13246.45 13143.31 13213.22 13171.16 13224.91
[6,] 13133.44 13150.62 13218.15 13294.07 13191.79 13261.98 13219.17 13272.38
       [,409]   [,410]   [,411]   [,412]   [,413]   [,414]   [,415]   [,416]
[1,] 13418.20 13323.21 13304.60 13283.88 13557.13 13582.96 13647.17 13615.95
[2,] 13461.92 13367.73 13349.26 13328.43 13600.58 13626.00 13690.18 13659.73
[3,] 13509.45 13416.11 13397.80 13376.84 13647.82 13672.79 13736.95 13707.31
[4,] 13557.55 13465.07 13446.90 13425.82 13695.62 13720.15 13784.27 13755.45
[5,] 13373.87 13280.14 13261.76 13240.86 13512.37 13537.55 13601.72 13571.70
[6,] 13421.71 13328.84 13310.62 13289.59 13559.91 13584.64 13648.78 13619.59
       [,417]   [,418]   [,419]   [,420]   [,421]   [,422]   [,423]   [,424]
[1,] 13767.72 13804.10 13637.83 13796.00 12295.92 12266.30 12288.99 12319.60
[2,] 13811.32 13847.60 13681.74 13839.39 12349.58 12319.52 12342.11 12372.64
[3,] 13858.70 13894.88 13729.46 13886.54 12407.74 12377.22 12399.70 12430.14
[4,] 13906.63 13942.72 13777.74 13934.25 12466.43 12435.46 12457.83 12488.18
[5,] 13723.18 13759.42 13593.79 13751.13 12268.18 12237.79 12260.30 12290.77
[6,] 13770.87 13807.00 13641.82 13798.59 12326.73 12295.88 12318.28 12348.66
       [,425]   [,426]   [,427]   [,428]   [,429]   [,430]   [,431]   [,432]
[1,] 12374.97 12365.01 12312.02 12295.92 16035.93 16021.59 15998.99 16684.09
[2,] 12428.13 12418.28 12365.60 12349.58 16074.41 16060.39 16037.86 16721.65
[3,] 12485.75 12476.03 12423.70 12407.74 16116.26 16102.56 16080.12 16762.48
[4,] 12543.91 12534.32 12482.32 12466.43 16158.61 16145.25 16122.89 16803.81
[5,] 12346.34 12336.59 12284.16 12268.18 15983.53 15969.65 15947.17 16630.30
[6,] 12404.35 12394.72 12342.63 12326.73 16025.61 16012.07 15989.67 16671.36
       [,433]   [,434]   [,435]   [,436]   [,437]   [,438]   [,439]   [,440]
[1,] 16678.24 16706.59 16734.04 16766.60 16819.90 16798.56 17061.47 17038.53
[2,] 16715.70 16744.01 16771.64 16804.29 16857.86 16836.92 17099.76 17076.65
[3,] 16756.44 16784.70 16812.52 16845.25 16899.10 16878.60 17141.36 17118.08
[4,] 16797.67 16825.89 16853.89 16886.71 16940.84 16920.76 17183.44 17159.99
[5,] 16624.32 16652.61 16680.32 16713.00 16766.70 16745.96 17008.76 16985.58
[6,] 16665.27 16693.52 16721.42 16754.19 16808.17 16787.86 17050.58 17027.23
       [,441]   [,442]   [,443]   [,444]   [,445]   [,446]   [,447]   [,448]
[1,] 17057.24 17154.28 17224.87 17084.43 17352.57 17317.80 17361.48 17576.44
[2,] 17094.94 17192.03 17262.80 17122.91 17389.27 17354.26 17398.19 17612.84
[3,] 17135.92 17233.05 17304.02 17164.72 17429.17 17393.89 17438.10 17652.41
[4,] 17177.38 17274.55 17345.71 17207.01 17469.54 17434.00 17478.49 17692.45
[5,] 17003.66 17100.77 17171.63 17032.01 17297.51 17262.38 17306.44 17520.94
[6,] 17044.86 17142.01 17213.07 17074.04 17337.62 17302.23 17346.56 17560.72
       [,449]   [,450]   [,451]   [,452]   [,453]   [,454]   [,455]   [,456]
[1,] 17577.62 17680.38 17576.44 16851.64 16947.70 17064.07 15125.22 15197.16
[2,] 17613.83 17715.90 17612.84 16891.81 16987.98 17104.41 15161.13 15233.17
[3,] 17653.19 17754.54 17652.41 16935.42 17031.72 17148.20 15200.26 15272.39
[4,] 17693.03 17793.65 17692.45 16979.51 17075.93 17192.46 15239.94 15312.17
[5,] 17521.84 17623.61 17520.94 16801.76 16898.00 17014.45 15069.04 15141.12
[6,] 17561.41 17662.45 17560.72 16845.61 16941.96 17058.47 15108.40 15180.58
       [,457]   [,458]   [,459]   [,460]   [,461]   [,462]   [,463]   [,464]
[1,] 15200.49 13869.69 13858.50 13867.28 13932.41 13993.98 13932.47 13295.88
[2,] 15236.90 13904.99 13893.60 13902.36 13967.09 14028.82 13967.66 13322.63
[3,] 15276.55 13943.49 13931.92 13940.65 14004.93 14066.84 14006.07 13352.04
[4,] 15316.75 13982.61 13970.84 13979.55 14043.39 14105.46 14045.08 13382.12
[5,] 15145.03 13812.62 13801.16 13809.91 13874.45 13936.25 13875.26 13226.98
[6,] 15184.92 13851.39 13839.73 13848.45 13912.55 13974.52 13913.92 13256.60
       [,465]   [,466]   [,467]   [,468]   [,469]   [,470]   [,471]   [,472]
[1,] 13245.92 13180.28 13163.98 13241.47 13399.54 13433.56 13458.61 13448.73
[2,] 13272.79 13205.83 13188.69 13266.37 13425.04 13459.26 13484.40 13475.14
[3,] 13302.31 13233.95 13215.91 13293.80 13453.10 13487.53 13512.77 13504.17
[4,] 13332.52 13262.77 13243.84 13321.91 13481.85 13516.48 13541.83 13533.87
[5,] 13177.17 13109.79 13092.39 13170.14 13328.99 13363.27 13388.44 13379.37
[6,] 13206.91 13138.12 13119.82 13197.76 13357.25 13391.74 13417.02 13408.61
       [,473]   [,474]   [,475]   [,476]   [,477]   [,478]   [,479]   [,480]
[1,] 13473.60 13446.86 13321.88 13295.88 17265.51 17291.74 17489.55 17572.35
[2,] 13500.53 13473.89 13349.26 13322.63 17284.58 17310.66 17508.28 17591.03
[3,] 13530.11 13503.58 13379.34 13352.04 17305.60 17331.52 17528.93 17611.62
[4,] 13560.36 13533.95 13410.09 13382.12 17327.18 17352.93 17550.12 17632.75
[5,] 13404.93 13378.33 13253.82 13226.98 17186.77 17212.81 17410.39 17493.13
[6,] 13434.72 13408.23 13284.11 13256.60 17207.91 17233.79 17431.15 17513.83
       [,481]   [,482]   [,483]   [,484]   [,485]   [,486]   [,487]   [,488]
[1,] 17576.91 17632.49 17523.71 14583.00 14552.58 14630.91 22554.71 23319.08
[2,] 17595.75 17651.31 17543.05 14593.13 14562.61 14641.09 22570.71 23330.87
[3,] 17616.51 17672.05 17564.35 14604.67 14574.03 14652.68 22588.30 23343.93
[4,] 17637.81 17693.33 17586.20 14616.88 14586.14 14664.94 22606.33 23357.42
[5,] 17497.88 17553.44 17445.30 14493.76 14463.23 14541.73 22472.24 23231.70
[6,] 17518.75 17574.29 17466.72 14505.38 14474.73 14553.40 22489.91 23244.82
       [,489]   [,490]   [,491]   [,492]   [,493]   [,494]   [,495]   [,496]
[1,] 23452.74 23451.60 23584.93 23548.01 22954.04 22914.97 22954.04 12887.92
[2,] 23465.23 23463.32 23596.65 23561.23 22967.09 22927.52 22967.09 12921.90
[3,] 23479.06 23476.33 23609.64 23575.83 22981.52 22941.41 22981.52 12959.04
[4,] 23493.31 23489.75 23623.04 23590.85 22996.37 22955.74 22996.37 12996.84
[5,] 23366.17 23364.15 23497.47 23462.27 22868.11 22828.46 22868.11 12828.97
[6,] 23380.06 23377.21 23510.52 23476.94 22882.60 22842.42 22882.60 12866.38
       [,497]   [,498]   [,499]   [,500]   [,501]   [,502]   [,503]   [,504]
[1,] 12913.26 13024.17 13166.29 13189.27 13197.88 13233.61 12942.53 18486.24
[2,] 12947.10 13057.96 13199.68 13222.97 13231.63 13267.29 12977.44 18538.01
[3,] 12984.10 13094.89 13236.18 13259.80 13268.53 13304.10 13015.58 18593.98
[4,] 13021.77 13132.49 13273.34 13297.29 13306.08 13341.56 13054.38 18650.32
[5,] 12854.12 12964.95 13106.50 13129.92 13138.61 13174.23 12884.92 18455.10
[6,] 12891.39 13002.15 13143.26 13167.02 13175.77 13211.30 12923.34 18511.33
       [,505]   [,506]   [,507]   [,508]   [,509]   [,510]   [,511]   [,512]
[1,] 18596.90 18578.12 13864.65 13850.05 13847.07 13841.64 13823.95 13864.62
[2,] 18648.68 18629.90 13899.53 13884.87 13881.91 13876.44 13858.60 13899.10
[3,] 18704.66 18685.89 13937.60 13922.87 13919.94 13914.41 13896.43 13936.74
[4,] 18761.00 18742.24 13976.28 13961.49 13958.57 13953.01 13934.86 13975.00
[5,] 18565.77 18547.01 13806.98 13792.30 13789.35 13783.85 13765.96 13806.38
[6,] 18622.00 18603.24 13845.31 13830.56 13827.63 13822.09 13804.03 13844.28
       [,513]   [,514]   [,515]   [,516]   [,517]   [,518]   [,519]   [,520]
[1,] 13898.99 13903.68 13906.59 13925.28 13910.89 13927.33 13955.14 13971.14
[2,] 13932.96 13937.81 13940.90 13959.54 13944.94 13961.32 13989.44 14005.61
[3,] 13970.06 13975.07 13978.36 13996.93 13982.12 13998.44 14026.88 14043.23
[4,] 14007.77 14012.95 14016.44 14034.94 14019.92 14036.18 14064.93 14081.46
[5,] 13840.02 13844.94 13848.11 13866.72 13852.04 13868.39 13896.64 13912.88
[6,] 13877.37 13882.45 13885.82 13904.36 13889.47 13905.76 13934.33 13950.75
       [,521]   [,522]   [,523]   [,524]   [,525]   [,526]   [,527]   [,528]
[1,] 13929.67 13868.03 13592.47 13587.00 13567.73 13590.94 13590.42 13684.62
[2,] 13964.28 13902.93 13626.02 13620.56 13601.34 13624.27 13623.70 13718.13
[3,] 14002.06 13941.01 13662.68 13657.23 13638.05 13660.69 13660.07 13754.74
[4,] 14040.45 13979.71 13699.98 13694.54 13675.40 13697.74 13697.07 13791.98
[5,] 13871.62 13810.39 13532.91 13527.45 13508.25 13531.06 13530.47 13625.00
[6,] 13909.65 13848.73 13569.82 13564.38 13545.22 13567.73 13567.09 13661.86
       [,529]   [,530]   [,531]   [,532]   [,533]   [,534]   [,535]   [,536]
[1,] 13683.97 13670.25 13298.36 13286.95 13284.88 13280.26 13269.68 13260.85
[2,] 13717.55 13703.90 13331.44 13320.04 13317.95 13313.34 13302.60 13293.79
[3,] 13754.24 13740.66 13367.61 13356.22 13354.10 13349.51 13338.60 13329.81
[4,] 13791.55 13778.04 13404.43 13393.04 13390.90 13386.32 13375.24 13366.48
[5,] 13624.45 13610.82 13238.13 13226.74 13224.63 13220.03 13209.22 13200.43
[6,] 13661.39 13647.83 13274.56 13263.17 13261.04 13256.45 13245.48 13236.70
       [,537]   [,538]   [,539]   [,540]   [,541]   [,542]   [,543]   [,544]
[1,] 13254.06 13282.00 13414.34 13473.02 13427.68 13402.05 6116.021 6135.637
[2,] 13286.91 13314.71 13446.75 13505.26 13460.56 13434.87 6070.353 6089.021
[3,] 13322.83 13350.49 13482.20 13540.52 13496.50 13470.76 6025.998 6043.699
[4,] 13359.41 13386.92 13518.29 13576.43 13533.09 13507.30 6017.484 6034.993
[5,] 13193.50 13221.26 13353.17 13411.61 13367.16 13341.46 5981.227 6000.391
[6,] 13229.68 13257.29 13388.86 13447.11 13403.36 13377.60 5936.207 5954.395
       [,545]   [,546]   [,547]   [,548]   [,549]   [,550]   [,551]   [,552]
[1,] 6142.811 6149.820 6195.210 6148.571 6219.898 6121.038 5890.290 5940.599
[2,] 6096.396 6103.486 6148.978 6102.348 6173.325 6074.281 5846.738 5897.970
[3,] 6051.279 6058.449 6104.035 6057.423 6128.031 6028.819 5804.581 5856.739
[4,] 6042.613 6049.799 6095.403 6048.795 6119.328 6020.086 5796.506 5848.844
[5,] 6007.661 6014.708 6060.148 6013.512 6084.675 5985.726 5756.548 5807.339
[6,] 5961.871 5969.001 6014.541 5967.918 6038.715 5939.587 5713.726 5765.460
       [,553]   [,554]   [,555]
[1,] 5937.552 5884.930 11788.54
[2,] 5894.878 5827.622 11750.24
[3,] 5853.601 5771.477 11712.66
[4,] 5845.698 5760.640 11705.40
[5,] 5804.268 5745.552 11657.77
[6,] 5762.342 5688.597 11619.90

Distances

  • We want to find the MINIMUM distance to a primary school for each grid cell
Code
closest <- apply(distances, 1, "min")
grids$closest_primary <- closest

The map for primary school

The map for primary school

What if we want to calculate proportion of population?

  • Let’s create some new values
Code
totalpop <- sum(grids$pop)
# within 1km
popwithin1km <- sum(grids$pop[grids$closest_primary <= 1000])/totalpop
# within 2km
popwithin2km <- sum(grids$pop[grids$closest_primary <= 2000])/totalpop
# within 5km
popwithin5km <- sum(grids$pop[grids$closest_primary <= 5000])/totalpop

popmat <- matrix(c(popwithin1km, popwithin2km, popwithin5km), nrow = 1)
rownames(popmat) <- "Primary school"
colnames(popmat) <- c("1km", "2km", "5km")

What if we want to calculate proportion of population?

  • Let’s create some new values
Code
kable(popmat, digits = 3, row.names = TRUE) %>%
  kable_styling("striped", full_width = F) %>%
  column_spec(2:4, width = "2cm")
1km 2km 5km
Primary school 0.34 0.618 0.892

Your turn

  • Try it for middle and high schools!

Example code

distances <- distance(grids, df |> filter(fclass=="elementaryschool"))
distances <- apply(distances, 1, "min")

# within 1km
popwithin1km <- sum(grids$pop[distances <= 1000])/totalpop
# within 2km
popwithin2km <- sum(grids$pop[distances <= 2000])/totalpop
# within 5km
popwithin5km <- sum(grids$pop[distances <= 5000])/totalpop

popmat <- matrix(c(popwithin1km, popwithin2km, popwithin5km), nrow = 1)
rownames(popmat) <- "Primary school"
distancesmid <- distance(grids, df |> filter(fclass=="middleschool"))
distancesmid <- apply(distancesmid, 1, "min")

# within 1km
popwithin1kmmid <- sum(grids$pop[distancesmid <= 1000])/totalpop
# within 2km
popwithin2kmmid <- sum(grids$pop[distancesmid <= 2000])/totalpop
# within 5km
popwithin5kmmid <- sum(grids$pop[distancesmid <= 5000])/totalpop

popmatmid <- matrix(c(popwithin1kmmid, popwithin2kmmid, popwithin5kmmid), nrow = 1)
rownames(popmatmid) <- "Middle school"
distanceshigh <- distance(grids, df |> filter(fclass=="highschool"))
distanceshigh <- apply(distanceshigh, 1, "min")

# within 1km
popwithin1kmhigh <- sum(grids$pop[distanceshigh <= 1000])/totalpop
# within 2km
popwithin2kmhigh <- sum(grids$pop[distanceshigh <= 2000])/totalpop
# within 5km
popwithin5kmhigh <- sum(grids$pop[distanceshigh <= 5000])/totalpop

popmathigh <- matrix(c(popwithin1kmhigh, popwithin2kmhigh, popwithin5kmhigh), nrow = 1)
rownames(popmathigh) <- "High school"

The table

1km 2km 5km
Primary school 0.340 0.618 0.892
Middle school 0.328 0.628 0.910
High school 0.311 0.591 0.910

Using Python and the GEE API

Just for today, Python

  • We are going to:
    • Install Python
    • Install Positron
  • You should already have a GEE account from last week

Installing Python

  • If you already have Python installed, don’t install it!

  • You can check in the terminal/console:

Code
python --version
  • If it returns a version number, you have Python installed
    • We want it to be Python 3.XX.X (some version of python3)

Installing Python

  • If it is not downloaded, you have two options:
  • I recommend Anaconda (or miniconda) for beginners

Installing Positron

  • We are going to use the same IDE

  • Let’s install Positron

    • Same company that makes RStudio
    • It’s my favorite Python IDE
  • Go to the Positron website

    • First post > Assets > correct version for your OS

Next steps

  • Here’s what we are going to do:
    • Open a folder (maybe make a new one?)
    • Create a “virtual environment”
    • Install the packages we need

Step 1: Open a folder

Step 2: Create an environment

  • Now let’s create a “virtual environment”

Step 2: Create an environment

Code
python -m venv classenv
  • Positron will ask if you want to use the environment
    • Click “Yes”
  • It will also ask to install the ipykernel package
    • Click “Install”
  • This will create a new folder called classenv in your current directory (that you opened/made earlier)
    • This is where all the packages will be installed

Step 2: Create an environment

  • Finally, close Positron and reopen it

  • In the “Terminal” you should see the name of the environment you just created, something like this:

Code
(classenv) Joshs-MacBook-Pro:geospatialdataR Josh$

Step 3: Install packages

  • We need two separate packages:
    • earthengine-api
    • geopandas
  • We do this in the “Terminal”
Code
pip3 install earthengine-api geopandas

Step 3: Install packages

One last step: create a script!

  • In the upper left, you should see “New”
    • Click it, then click “New File”
    • Save it as inclassgee.py - MAKE SURE to add the .py extension!

Just like with R, load libraries

Code
# load libraries
1import ee
2import geopandas as gpd
1
This is the Earth Engine API library
2
This is the geopandas library (you’ll see what the as gpd does later)
  • Note we can create comments just like in RStudio
  • You can run them just like in RStudio (highlight and press ctrl/cmd + enter)

We need to initialize the API

  • Last week, you created a “project”
    • You need to figure out its name to use here! (upper-right corner of the code editor on GEE)
    • This should open a pop-up in your browser
Code
ee.Authenticate()
ee.Initialize(project="ee-geefolder")

Searching for data

Code
# Let's look at NDVI
ndvi = ee.ImageCollection("MODIS/061/MOD13A3")

# we can use "print" and "getInfo()" to look at more information
# If the above call worked correctly, you should see a bunch of information printed in the console
print(ndvi.getInfo())

Filtering by date

Code
# We can also filter the collection by date. Let's look september 2023
ndvi = ndvi.filterDate("2023-08-01", "2023-08-31")

# for assets that have many bands (raster layers), we can select the specific ones we want:
ndvi = ndvi.select("NDVI")
ndvi

# finally, just make sure we have an IMAGE, not an image collection
ndvi = ndvi.mean()
ndvi

Filtering by area

  • Let’s use Korea to pull data
    • week7files: kgrid.shp
    • Going to read this into Python using geopandas
Code
# let's load the shapefile (note the use of "gpd" instead of "geopandas"!)
shape = gpd.read_file("week7files/kgrid.shp")
# make sure it is in lat/lon (project it)
shape = shape.to_crs("EPSG:4326")
# let's get the total bounds for the shapefile
bounds = shape.total_bounds
bounds

Downloading

Code
# let's create a bounding box in earth engine. Note the syntax (xmin, ymin, xmax, ymax)
# this does not accept an array (which is what bounds was), so we will extract the individual components
# Also note that indexing in python starts at 0, not 1! bounds[0] gives the first value in the array
bbox = ee.Geometry.BBox(bounds[0], bounds[1], bounds[2], bounds[3])

task = ee.batch.Export.image.toDrive(image=ndvi,
    description="krndvi",
    scale=1000, # set scale the same as the raster's resolution (you can find this on GEE)
    region=bbox,
    crs="EPSG:4326",
    fileFormat="GeoTIFF")
# start the task. You must do this for GEE to actually run the command.
task.start()
# can check the status of the task
task.status()

Some notes on downloading

  • You do not have to check the status
    • It will finish automatically
  • You can start multiple tasks
  • Some tasks will take longer than others
    • One way to speed it up: use a larger resolution (e.g. 100 instead of 10)

Land classification

  • Now let’s download land classification for the most recent year

  • Find the appropriate GEE id

    • Let’s use the Copernicus Global Land Cover Layers
  • What is the id?
  • What are the available dates?

Land classification

Land classification

Code
# land classification
lc = ee.ImageCollection("COPERNICUS/Landcover/100m/Proba-V-C3/Global")

# Only 2021
lc = lc.filterDate("2019-01-01", "2019-12-31")
# just make sure we have an IMAGE, not an image collection
lc = lc.first()
# let's try something different: download the discrete_classification only
lc = lc.select("discrete_classification")

task = ee.batch.Export.image.toDrive(image=lc,
    description="krlc",
    scale=100, # Let's do 100 (for time and memory)
    region=bbox,
    crs="EPSG:4326",
    fileFormat="GeoTIFF")
task.start()
task.status()

Land classification

  • While we wait for that to download, I’ve already downloaded it for you!
    • week7files/krlc.tf
  • Let’s look at it in R, using terra

The raster

  • What are we looking at here?
Code
lc <- rast("week7files/krlc.tif")
head(lc)
  discrete_classification
1                     200
2                     200
3                     200
4                     200
5                     200
6                     200
  • We need to turn this into a factor!

This isn’t straightforward…

  • This discrete classification variable is not numeric
    • We need to find out what the values represent
    • How?
  • Let’s check the GEE page for this data

Land classification

How to get the values?

  • We could of course write them all by hand!

  • For example, let’s create a new variable that just has 8 values:

    • 0: No data
    • 1: Shrubs/plants
    • 2: Agricultural land
    • 3: Urban
    • 4: Bare land
    • 5: Snow/ice
    • 6: Water
    • 7: Forest

Creating the data

Code
factorvalues <- data.frame(value = 0:7, 
  class = c("No data", "Shrubs/plants", "Agricultural land", "Urban", "Bare land", "Snow/ice", "Water", "Forest"))
factorvalues
  value             class
1     0           No data
2     1     Shrubs/plants
3     2 Agricultural land
4     3             Urban
5     4         Bare land
6     5          Snow/ice
7     6             Water
8     7            Forest

Now: change values of raster

Code
lcnew <- lc |> 
  mutate(discrete_classification = case_when(
  discrete_classification == 0 ~ 0,
  discrete_classification %in% c(20, 30, 90, 100) ~ 1,
  discrete_classification == 40 ~ 2,
  discrete_classification == 50 ~ 3,
  discrete_classification == 60 ~ 4,
  discrete_classification == 70 ~ 5,
  discrete_classification %in% c(80, 200)  ~ 6,
  TRUE ~ 7
))
Code
# Double check
summary(lcnew)
 discrete_classification
 Min.   :1.00           
 1st Qu.:6.00           
 Median :6.00           
 Mean   :5.79           
 3rd Qu.:6.00           
 Max.   :7.00           

Now: create labels and assign

Code
cls<- data.frame(id = 0:7,
  cover = c("No data", "Shrubs/plants", "Agricultural land", "Urban", "Bare land", "Snow/ice", "Water", "Forest"))
levels(lcnew) <- cls
lcnew
class       : SpatRaster 
dimensions  : 6128, 7078, 1  (nrow, ncol, nlyr)
resolution  : 0.0008983153, 0.0008983153  (x, y)
extent      : 124.608, 130.9663, 33.1128, 38.61768  (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 (EPSG:4326) 
source(s)   : memory
color table : 1 
categories  : cover 
name        :         cover 
min value   : Shrubs/plants 
max value   :        Forest 
Code
levels(lcnew)
[[1]]
  id             cover
1  0           No data
2  1     Shrubs/plants
3  2 Agricultural land
4  3             Urban
5  4         Bare land
6  5          Snow/ice
7  6             Water
8  7            Forest

Plot it

Code
ggplot() +
  geom_spatraster(data = lcnew, aes(fill = cover)) +
  # Note we need fewer than 8 colors! Only 7 show up in our raster
  scale_fill_manual("Classification", values = c("#ffbb22", "#f096ff", "#fa0000", "#b4b4b4", "#f0f0f0", "#0032c8", "#58481f")) +
  theme_bw()

Plot it

But what if we want ALL of the classes?

  • Do you want to do them all by hand?
    • I assume not.
  • So what are we to do?
  • The GEE API in Python has all the info!

Back to python

True
Code
lcinfo = lc.getInfo()
type(lcinfo)
<class 'dict'>
Code
lcinfo
{'type': 'Image', 'bands': [{'id': 'discrete_classification', 'data_type': {'type': 'PixelType', 'precision': 'int', 'min': 0, 'max': 255}, 'dimensions': [400750, 240450], 'crs': 'EPSG:3857', 'crs_transform': [100, 0, -20037550, 0, -100, 15538800]}], 'version': 1685078284447716, 'id': 'COPERNICUS/Landcover/100m/Proba-V-C3/Global/2019', 'properties': {'discrete_classification_class_names': ['Unknown. No or not enough satellite data available.', 'Shrubs. Woody perennial plants with persistent and woody stems\nand without any defined main stem being less than 5 m tall. The\nshrub foliage can be either evergreen or deciduous.\n', 'Herbaceous vegetation. Plants without persistent stem or shoots above ground\nand lacking definite firm structure. Tree and shrub cover is less\nthan 10 %.\n', 'Cultivated and managed vegetation / agriculture. Lands covered with temporary crops followed by harvest\nand a bare soil period (e.g., single and multiple cropping systems).\nNote that perennial woody crops will be classified as the appropriate\nforest or shrub land cover type.\n', 'Urban / built up. Land covered by buildings and other man-made structures.', 'Bare / sparse vegetation. Lands with exposed soil, sand, or rocks and never has\nmore than 10 % vegetated cover during any time of the year.\n', 'Snow and ice. Lands under snow or ice cover throughout the year.', 'Permanent water bodies. Lakes, reservoirs, and rivers. Can be either fresh or salt-water bodies.', 'Herbaceous wetland. Lands with a permanent mixture of water and herbaceous\nor woody vegetation. The vegetation can be present in either salt,\nbrackish, or fresh water.\n', 'Moss and lichen.', 'Closed forest, evergreen needle leaf. Tree canopy >70 %, almost all needle leaf trees remain\ngreen all year. Canopy is never without green foliage.\n', 'Closed forest, evergreen broad leaf. Tree canopy >70 %, almost all broadleaf trees remain\ngreen year round. Canopy is never without green foliage.\n', 'Closed forest, deciduous needle leaf. Tree canopy >70 %, consists of seasonal needle leaf\ntree communities with an annual cycle of leaf-on and leaf-off\nperiods.\n', 'Closed forest, deciduous broad leaf. Tree canopy >70 %, consists of seasonal broadleaf\ntree communities with an annual cycle of leaf-on and leaf-off periods.\n', 'Closed forest, mixed.', 'Closed forest, not matching any of the other definitions.', 'Open forest, evergreen needle leaf. Top layer- trees 15-70 % and second layer- mixed of shrubs\nand grassland, almost all needle leaf trees remain green all year.\nCanopy is never without green foliage.\n', 'Open forest, evergreen broad leaf. Top layer- trees 15-70 % and second layer- mixed of shrubs\nand grassland, almost all broadleaf trees remain green year round.\nCanopy is never without green foliage.\n', 'Open forest, deciduous needle leaf. Top layer- trees 15-70 % and second layer- mixed of shrubs\nand grassland, consists of seasonal needle leaf tree communities with\nan annual cycle of leaf-on and leaf-off periods.\n', 'Open forest, deciduous broad leaf. Top layer- trees 15-70 % and second layer- mixed of shrubs\nand grassland, consists of seasonal broadleaf tree communities with\nan annual cycle of leaf-on and leaf-off periods.\n', 'Open forest, mixed.', 'Open forest, not matching any of the other definitions.', 'Oceans, seas. Can be either fresh or salt-water bodies.'], 'forest_type_class_names': ['Unknown', 'Evergreen needle leaf', 'Evergreen broad leaf', 'Deciduous needle leaf', 'Deciduous broad leaf', 'Mix of forest types'], 'forest_type_class_palette': ['282828', '666000', '009900', '70663e', 'a0dc00', '929900'], 'system:time_end': 1577836800000, 'discrete_classification_class_values': [0, 20, 30, 40, 50, 60, 70, 80, 90, 100, 111, 112, 113, 114, 115, 116, 121, 122, 123, 124, 125, 126, 200], 'system:time_start': 1546300800000, 'discrete_classification_class_palette': ['282828', 'ffbb22', 'ffff4c', 'f096ff', 'fa0000', 'b4b4b4', 'f0f0f0', '0032c8', '0096a0', 'fae6a0', '58481f', '009900', '70663e', '00cc00', '4e751f', '007800', '666000', '8db400', '8d7400', 'a0dc00', '929900', '648c00', '000080'], 'system:footprint': {'type': 'LinearRing', 'coordinates': [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]}, 'forest_type_class_values': [0, 1, 2, 3, 4, 5], 'system:asset_size': 84728363000, 'system:index': '2019'}}

“properties” is what we want

Code
import pandas as pd
lcprop = lcinfo["properties"]
lcprop = pd.DataFrame.from_dict({"id": lcprop["discrete_classification_class_values"], 
  "cover": lcprop["discrete_classification_class_names"]})
lcprop
     id                                              cover
0     0  Unknown. No or not enough satellite data avail...
1    20  Shrubs. Woody perennial plants with persistent...
2    30  Herbaceous vegetation. Plants without persiste...
3    40  Cultivated and managed vegetation / agricultur...
4    50  Urban / built up. Land covered by buildings an...
5    60  Bare / sparse vegetation. Lands with exposed s...
6    70  Snow and ice. Lands under snow or ice cover th...
7    80  Permanent water bodies. Lakes, reservoirs, and...
8    90  Herbaceous wetland. Lands with a permanent mix...
9   100                                   Moss and lichen.
10  111  Closed forest, evergreen needle leaf. Tree can...
11  112  Closed forest, evergreen broad leaf. Tree cano...
12  113  Closed forest, deciduous needle leaf. Tree can...
13  114  Closed forest, deciduous broad leaf. Tree cano...
14  115                              Closed forest, mixed.
15  116  Closed forest, not matching any of the other d...
16  121  Open forest, evergreen needle leaf. Top layer-...
17  122  Open forest, evergreen broad leaf. Top layer- ...
18  123  Open forest, deciduous needle leaf. Top layer-...
19  124  Open forest, deciduous broad leaf. Top layer- ...
20  125                                Open forest, mixed.
21  126  Open forest, not matching any of the other def...
22  200  Oceans, seas. Can be either fresh or salt-wate...

Let’s save it as a .csv file

Code
lcprop.to_csv("week7files/lcprop.csv", index = False)

Bring it into R

Code
lcprop <- read_csv("week7files/lcprop.csv")
head(lcprop)
# A tibble: 6 × 2
     id cover                                                                   
  <dbl> <chr>                                                                   
1     0 "Unknown. No or not enough satellite data available."                   
2    20 "Shrubs. Woody perennial plants with persistent and woody stems\nand wi…
3    30 "Herbaceous vegetation. Plants without persistent stem or shoots above …
4    40 "Cultivated and managed vegetation / agriculture. Lands covered with te…
5    50 "Urban / built up. Land covered by buildings and other man-made structu…
6    60 "Bare / sparse vegetation. Lands with exposed soil, sand, or rocks and …
Code
lcnew <- lc
levels(lcnew) <- data.frame(lcprop[,1:2])

Quick plot

Code
plot(lcnew)

It already has the colors!

  • The information on colors is actually already in the raster!
Code
coltab(lcnew)
[[1]]
    value red green blue alpha
1       0  40    40   40   255
2       1   0     0    0   255
3       2   0     0    0   255
4       3   0     0    0   255
5       4   0     0    0   255
6       5   0     0    0   255
7       6   0     0    0   255
8       7   0     0    0   255
9       8   0     0    0   255
10      9   0     0    0   255
11     10   0     0    0   255
12     11   0     0    0   255
13     12   0     0    0   255
14     13   0     0    0   255
15     14   0     0    0   255
16     15   0     0    0   255
17     16   0     0    0   255
18     17   0     0    0   255
19     18   0     0    0   255
20     19   0     0    0   255
21     20 255   187   34   255
22     21   0     0    0   255
23     22   0     0    0   255
24     23   0     0    0   255
25     24   0     0    0   255
26     25   0     0    0   255
27     26   0     0    0   255
28     27   0     0    0   255
29     28   0     0    0   255
30     29   0     0    0   255
31     30 255   255   76   255
32     31   0     0    0   255
33     32   0     0    0   255
34     33   0     0    0   255
35     34   0     0    0   255
36     35   0     0    0   255
37     36   0     0    0   255
38     37   0     0    0   255
39     38   0     0    0   255
40     39   0     0    0   255
41     40 240   150  255   255
42     41   0     0    0   255
43     42   0     0    0   255
44     43   0     0    0   255
45     44   0     0    0   255
46     45   0     0    0   255
47     46   0     0    0   255
48     47   0     0    0   255
49     48   0     0    0   255
50     49   0     0    0   255
51     50 250     0    0   255
52     51   0     0    0   255
53     52   0     0    0   255
54     53   0     0    0   255
55     54   0     0    0   255
56     55   0     0    0   255
57     56   0     0    0   255
58     57   0     0    0   255
59     58   0     0    0   255
60     59   0     0    0   255
61     60 180   180  180   255
62     61   0     0    0   255
63     62   0     0    0   255
64     63   0     0    0   255
65     64   0     0    0   255
66     65   0     0    0   255
67     66   0     0    0   255
68     67   0     0    0   255
69     68   0     0    0   255
70     69   0     0    0   255
71     70 240   240  240   255
72     71   0     0    0   255
73     72   0     0    0   255
74     73   0     0    0   255
75     74   0     0    0   255
76     75   0     0    0   255
77     76   0     0    0   255
78     77   0     0    0   255
79     78   0     0    0   255
80     79   0     0    0   255
81     80   0    50  200   255
82     81   0     0    0   255
83     82   0     0    0   255
84     83   0     0    0   255
85     84   0     0    0   255
86     85   0     0    0   255
87     86   0     0    0   255
88     87   0     0    0   255
89     88   0     0    0   255
90     89   0     0    0   255
91     90   0   150  160   255
92     91   0     0    0   255
93     92   0     0    0   255
94     93   0     0    0   255
95     94   0     0    0   255
96     95   0     0    0   255
97     96   0     0    0   255
98     97   0     0    0   255
99     98   0     0    0   255
100    99   0     0    0   255
101   100 250   230  160   255
102   101   0     0    0   255
103   102   0     0    0   255
104   103   0     0    0   255
105   104   0     0    0   255
106   105   0     0    0   255
107   106   0     0    0   255
108   107   0     0    0   255
109   108   0     0    0   255
110   109   0     0    0   255
111   110   0     0    0   255
112   111  88    72   31   255
113   112   0   153    0   255
114   113 112   102   62   255
115   114   0   204    0   255
116   115  78   117   31   255
117   116   0   120    0   255
118   117   0     0    0   255
119   118   0     0    0   255
120   119   0     0    0   255
121   120   0     0    0   255
122   121 102    96    0   255
123   122 141   180    0   255
124   123 141   116    0   255
125   124 160   220    0   255
126   125 146   153    0   255
127   126 100   140    0   255
128   127   0     0    0   255
129   128   0     0    0   255
130   129   0     0    0   255
131   130   0     0    0   255
132   131   0     0    0   255
133   132   0     0    0   255
134   133   0     0    0   255
135   134   0     0    0   255
136   135   0     0    0   255
137   136   0     0    0   255
138   137   0     0    0   255
139   138   0     0    0   255
140   139   0     0    0   255
141   140   0     0    0   255
142   141   0     0    0   255
143   142   0     0    0   255
144   143   0     0    0   255
145   144   0     0    0   255
146   145   0     0    0   255
147   146   0     0    0   255
148   147   0     0    0   255
149   148   0     0    0   255
150   149   0     0    0   255
151   150   0     0    0   255
152   151   0     0    0   255
153   152   0     0    0   255
154   153   0     0    0   255
155   154   0     0    0   255
156   155   0     0    0   255
157   156   0     0    0   255
158   157   0     0    0   255
159   158   0     0    0   255
160   159   0     0    0   255
161   160   0     0    0   255
162   161   0     0    0   255
163   162   0     0    0   255
164   163   0     0    0   255
165   164   0     0    0   255
166   165   0     0    0   255
167   166   0     0    0   255
168   167   0     0    0   255
169   168   0     0    0   255
170   169   0     0    0   255
171   170   0     0    0   255
172   171   0     0    0   255
173   172   0     0    0   255
174   173   0     0    0   255
175   174   0     0    0   255
176   175   0     0    0   255
177   176   0     0    0   255
178   177   0     0    0   255
179   178   0     0    0   255
180   179   0     0    0   255
181   180   0     0    0   255
182   181   0     0    0   255
183   182   0     0    0   255
184   183   0     0    0   255
185   184   0     0    0   255
186   185   0     0    0   255
187   186   0     0    0   255
188   187   0     0    0   255
189   188   0     0    0   255
190   189   0     0    0   255
191   190   0     0    0   255
192   191   0     0    0   255
193   192   0     0    0   255
194   193   0     0    0   255
195   194   0     0    0   255
196   195   0     0    0   255
197   196   0     0    0   255
198   197   0     0    0   255
199   198   0     0    0   255
200   199   0     0    0   255
201   200   0     0  128   255
202   201   0     0    0   255
203   202   0     0    0   255
204   203   0     0    0   255
205   204   0     0    0   255
206   205   0     0    0   255
207   206   0     0    0   255
208   207   0     0    0   255
209   208   0     0    0   255
210   209   0     0    0   255
211   210   0     0    0   255
212   211   0     0    0   255
213   212   0     0    0   255
214   213   0     0    0   255
215   214   0     0    0   255
216   215   0     0    0   255
217   216   0     0    0   255
218   217   0     0    0   255
219   218   0     0    0   255
220   219   0     0    0   255
221   220   0     0    0   255
222   221   0     0    0   255
223   222   0     0    0   255
224   223   0     0    0   255
225   224   0     0    0   255
226   225   0     0    0   255
227   226   0     0    0   255
228   227   0     0    0   255
229   228   0     0    0   255
230   229   0     0    0   255
231   230   0     0    0   255
232   231   0     0    0   255
233   232   0     0    0   255
234   233   0     0    0   255
235   234   0     0    0   255
236   235   0     0    0   255
237   236   0     0    0   255
238   237   0     0    0   255
239   238   0     0    0   255
240   239   0     0    0   255
241   240   0     0    0   255
242   241   0     0    0   255
243   242   0     0    0   255
244   243   0     0    0   255
245   244   0     0    0   255
246   245   0     0    0   255
247   246   0     0    0   255
248   247   0     0    0   255
249   248   0     0    0   255
250   249   0     0    0   255
251   250   0     0    0   255
252   251   0     0    0   255
253   252   0     0    0   255
254   253   0     0    0   255
255   254   0     0    0   255
256   255   0     0    0   255

Plot it

Code
ggplot() +
  geom_spatraster(data = lcnew, aes(fill = cover), show.legend = FALSE) +
  theme_bw()

Plot it

Adding a legend (need to make it small)

Code
ggplot() +
  geom_spatraster(data = lcnew, aes(fill = cover)) +
  theme_bw() +
  labs(fill = "Land cover") +
  theme(legend.text=element_text(size=rel(0.5)), legend.key.size = unit(0.25, "cm"))

Adding a legend (need to make it small)

Extracting the data

  • Let’s see what happens if we extract the data using exactextractr
  • We need to read the shapefile using sf, NOT terra
Code
library(exactextractr)
kgrid <- sf::read_sf("week7files/kgrid.shp") # this way I don't have to load sf!
# reproject
lcnew <- project(lcnew, crs(kgrid))
extracted <- exact_extract(lcnew, kgrid, progress = FALSE)
# it's a list!
class(extracted)
[1] "list"

Extracting the data

  • The list is the same length as the number of grid cells
Code
nrow(kgrid)
[1] 4906
Code
length(extracted)
[1] 4906
Code
# here's the first one
extracted[[1]]
     value coverage_fraction
1      124         0.6772069
2      114         0.7274001
3      114         0.7274001
4      114         0.7274001
5      124         0.7274001
6      124         0.7274001
7      114         0.7274001
8      114         0.7274001
9      114         0.7274001
10     114         0.7274001
11     114         0.7274001
12     116         0.7274001
13     116         0.7274001
14     114         0.7274001
15     114         0.7274001
16     114         0.7274001
17      30         0.7274001
18      30         0.7274001
19      30         0.7274001
20     126         0.7274001
21     126         0.7274001
22      40         0.7274001
23      40         0.7274001
24      30         0.7274001
25      30         0.7274001
26      30         0.7274001
27      30         0.7274001
28      90         0.7274001
29      30         0.7274001
30      20         0.7274001
31      20         0.7274001
32     126         0.7274001
33     124         0.7274001
34     114         0.7274001
35     114         0.7274001
36     114         0.7274001
37     114         0.7274001
38     116         0.7274001
39     116         0.7274001
40     114         0.7274001
41     116         0.7274001
42     116         0.7274001
43     116         0.7274001
44     116         0.7274001
45     116         0.7274001
46     116         0.7274001
47     116         0.7274001
48     116         0.7274001
49     116         0.7274001
50      30         0.7274001
51      30         0.7274001
52      30         0.7274001
53      30         0.7274001
54     114         0.7274001
55     114         0.7274001
56     114         0.6823409
57     114         0.9309964
58     114         1.0000000
59     114         1.0000000
60     114         1.0000000
61     114         1.0000000
62     114         1.0000000
63     114         1.0000000
64     114         1.0000000
65     114         1.0000000
66     114         1.0000000
67     114         1.0000000
68     114         1.0000000
69     124         1.0000000
70     124         1.0000000
71     114         1.0000000
72     124         1.0000000
73      30         1.0000000
74      30         1.0000000
75      30         1.0000000
76     126         1.0000000
77      40         1.0000000
78      40         1.0000000
79      40         1.0000000
80      40         1.0000000
81      30         1.0000000
82      30         1.0000000
83      30         1.0000000
84      30         1.0000000
85      30         1.0000000
86      90         1.0000000
87      90         1.0000000
88      40         1.0000000
89     124         1.0000000
90     114         1.0000000
91     114         1.0000000
92     114         1.0000000
93     114         1.0000000
94     116         1.0000000
95     116         1.0000000
96     114         1.0000000
97     116         1.0000000
98     116         1.0000000
99     116         1.0000000
100    116         1.0000000
101    116         1.0000000
102    116         1.0000000
103    116         1.0000000
104    116         1.0000000
105    116         1.0000000
106     30         1.0000000
107     30         1.0000000
108     30         1.0000000
109    116         1.0000000
110    114         1.0000000
111    114         1.0000000
112    114         0.9380544
113    114         0.9309964
114    114         1.0000000
115    114         1.0000000
116    114         1.0000000
117    114         1.0000000
118    114         1.0000000
119    114         1.0000000
120    114         1.0000000
121    114         1.0000000
122    124         1.0000000
123    124         1.0000000
124    124         1.0000000
125    124         1.0000000
126    114         1.0000000
127    114         1.0000000
128    114         1.0000000
129    124         1.0000000
130     30         1.0000000
131     30         1.0000000
132    126         1.0000000
133     40         1.0000000
134     40         1.0000000
135     40         1.0000000
136     40         1.0000000
137     20         1.0000000
138     30         1.0000000
139     30         1.0000000
140     30         1.0000000
141     30         1.0000000
142     90         1.0000000
143     90         1.0000000
144     20         1.0000000
145    124         1.0000000
146    114         1.0000000
147    114         1.0000000
148    114         1.0000000
149    116         1.0000000
150    116         1.0000000
151    116         1.0000000
152    114         1.0000000
153    116         1.0000000
154    116         1.0000000
155    116         1.0000000
156    116         1.0000000
157    116         1.0000000
158    116         1.0000000
159    116         1.0000000
160    116         1.0000000
161    116         1.0000000
162     30         1.0000000
163     30         1.0000000
164     30         1.0000000
165    116         1.0000000
166    114         1.0000000
167    114         1.0000000
168    114         0.9380544
169    114         0.9309964
170    114         1.0000000
171    114         1.0000000
172    114         1.0000000
173    114         1.0000000
174    114         1.0000000
175    114         1.0000000
176    114         1.0000000
177    124         1.0000000
178    124         1.0000000
179    124         1.0000000
180    124         1.0000000
181    124         1.0000000
182    114         1.0000000
183    114         1.0000000
184    124         1.0000000
185     30         1.0000000
186     30         1.0000000
187     30         1.0000000
188     40         1.0000000
189     40         1.0000000
190     40         1.0000000
191     40         1.0000000
192     40         1.0000000
193     40         1.0000000
194     30         1.0000000
195     30         1.0000000
196     30         1.0000000
197     30         1.0000000
198     90         1.0000000
199     90         1.0000000
200     20         1.0000000
201    126         1.0000000
202    114         1.0000000
203    114         1.0000000
204    116         1.0000000
205    116         1.0000000
206    116         1.0000000
207    116         1.0000000
208    116         1.0000000
209    116         1.0000000
210    116         1.0000000
211    116         1.0000000
212    116         1.0000000
213    116         1.0000000
214    116         1.0000000
215    116         1.0000000
216    114         1.0000000
217    116         1.0000000
218     30         1.0000000
219     30         1.0000000
220    114         1.0000000
221    114         1.0000000
222    114         1.0000000
223    114         1.0000000
224    114         0.9380544
225    114         0.9309964
226    114         1.0000000
227    114         1.0000000
228    114         1.0000000
229    114         1.0000000
230    114         1.0000000
231    114         1.0000000
232    114         1.0000000
233    124         1.0000000
234    124         1.0000000
235    124         1.0000000
236     30         1.0000000
237    124         1.0000000
238    114         1.0000000
239    114         1.0000000
240    124         1.0000000
241     30         1.0000000
242     30         1.0000000
243     30         1.0000000
244     40         1.0000000
245     40         1.0000000
246     40         1.0000000
247     40         1.0000000
248     50         1.0000000
249     50         1.0000000
250     30         1.0000000
251     30         1.0000000
252     30         1.0000000
253     30         1.0000000
254     90         1.0000000
255     90         1.0000000
256    126         1.0000000
257    126         1.0000000
258    114         1.0000000
259    116         1.0000000
260    116         1.0000000
261    116         1.0000000
262    116         1.0000000
263    116         1.0000000
264    116         1.0000000
265    116         1.0000000
266    116         1.0000000
267    116         1.0000000
268    114         1.0000000
269    114         1.0000000
270    114         1.0000000
271    114         1.0000000
272    124         1.0000000
273    116         1.0000000
274    114         1.0000000
275    114         1.0000000
276    114         1.0000000
277    114         1.0000000
278    114         1.0000000
279    114         1.0000000
280    114         0.9380544
281    114         0.9309964
282    114         1.0000000
283    114         1.0000000
284    114         1.0000000
285    114         1.0000000
286    114         1.0000000
287    114         1.0000000
288    124         1.0000000
289    124         1.0000000
290    114         1.0000000
291    114         1.0000000
292    116         1.0000000
293    116         1.0000000
294    124         1.0000000
295    114         1.0000000
296     30         1.0000000
297     30         1.0000000
298     30         1.0000000
299     30         1.0000000
300     40         1.0000000
301     40         1.0000000
302     40         1.0000000
303    126         1.0000000
304     50         1.0000000
305     50         1.0000000
306     20         1.0000000
307     20         1.0000000
308     30         1.0000000
309     30         1.0000000
310     40         1.0000000
311     40         1.0000000
312     40         1.0000000
313    114         1.0000000
314    116         1.0000000
315    116         1.0000000
316    116         1.0000000
317    116         1.0000000
318    116         1.0000000
319    116         1.0000000
320    116         1.0000000
321    116         1.0000000
322    116         1.0000000
323    114         1.0000000
324    114         1.0000000
325    114         1.0000000
326    114         1.0000000
327    114         1.0000000
328    114         1.0000000
329    114         1.0000000
330    114         1.0000000
331    114         1.0000000
332    114         1.0000000
333    114         1.0000000
334    114         1.0000000
335    114         1.0000000
336    114         0.9380544
337    114         0.9309964
338    114         1.0000000
339    114         1.0000000
340    114         1.0000000
341    114         1.0000000
342    114         1.0000000
343    114         1.0000000
344    114         1.0000000
345    114         1.0000000
346    114         1.0000000
347    114         1.0000000
348    116         1.0000000
349    116         1.0000000
350     30         1.0000000
351     30         1.0000000
352    114         1.0000000
353     30         1.0000000
354     30         1.0000000
355     30         1.0000000
356     40         1.0000000
357     40         1.0000000
358     40         1.0000000
359     40         1.0000000
360     50         1.0000000
361     40         1.0000000
362     40         1.0000000
363     40         1.0000000
364     30         1.0000000
365     30         1.0000000
366     40         1.0000000
367     40         1.0000000
368     40         1.0000000
369    126         1.0000000
370    114         1.0000000
371    114         1.0000000
372    114         1.0000000
373    114         1.0000000
374    114         1.0000000
375    114         1.0000000
376    114         1.0000000
377    114         1.0000000
378    114         1.0000000
379    114         1.0000000
380    114         1.0000000
381    114         1.0000000
382    114         1.0000000
383    114         1.0000000
384    114         1.0000000
385    114         1.0000000
386    114         1.0000000
387    114         1.0000000
388    114         1.0000000
389    114         1.0000000
390    114         1.0000000
391    114         1.0000000
392    114         0.9380544
393    114         0.9309964
394    114         1.0000000
395    114         1.0000000
396    114         1.0000000
397    114         1.0000000
398    114         1.0000000
399    114         1.0000000
400    114         1.0000000
401    114         1.0000000
402    114         1.0000000
403    114         1.0000000
404    124         1.0000000
405     30         1.0000000
406     30         1.0000000
407     30         1.0000000
408    124         1.0000000
409    124         1.0000000
410    126         1.0000000
411    126         1.0000000
412     40         1.0000000
413     40         1.0000000
414     40         1.0000000
415     40         1.0000000
416     40         1.0000000
417     40         1.0000000
418     20         1.0000000
419     20         1.0000000
420     80         1.0000000
421     30         1.0000000
422     20         1.0000000
423     20         1.0000000
424    126         1.0000000
425    114         1.0000000
426    114         1.0000000
427    114         1.0000000
428    114         1.0000000
429    114         1.0000000
430    114         1.0000000
431    114         1.0000000
432    114         1.0000000
433    114         1.0000000
434    114         1.0000000
435    114         1.0000000
436    114         1.0000000
437    114         1.0000000
438    114         1.0000000
439    114         1.0000000
440    114         1.0000000
441    114         1.0000000
442    114         1.0000000
443    114         1.0000000
444    114         1.0000000
445    114         1.0000000
446    114         1.0000000
447    114         1.0000000
448    114         0.9380544
449    114         0.9309964
450    114         1.0000000
451    114         1.0000000
452    114         1.0000000
453    114         1.0000000
454    114         1.0000000
455    114         1.0000000
456    114         1.0000000
457    114         1.0000000
458    124         1.0000000
459    124         1.0000000
460    124         1.0000000
461    124         1.0000000
462    124         1.0000000
463    124         1.0000000
464    124         1.0000000
465    114         1.0000000
466    124         1.0000000
467    124         1.0000000
468    126         1.0000000
469     40         1.0000000
470     40         1.0000000
471     40         1.0000000
472     40         1.0000000
473     40         1.0000000
474     40         1.0000000
475     40         1.0000000
476     30         1.0000000
477     30         1.0000000
478    126         1.0000000
479    126         1.0000000
480    114         1.0000000
481    114         1.0000000
482    114         1.0000000
483    114         1.0000000
484    114         1.0000000
485    114         1.0000000
486    114         1.0000000
487    114         1.0000000
488    114         1.0000000
489    114         1.0000000
490    114         1.0000000
491    114         1.0000000
492    114         1.0000000
493    114         1.0000000
494    114         1.0000000
495    114         1.0000000
496    114         1.0000000
497    114         1.0000000
498    114         1.0000000
499    114         1.0000000
500    114         1.0000000
501    114         1.0000000
502    114         1.0000000
503    114         1.0000000
504    114         0.9380544
505    114         0.9309964
506    114         1.0000000
507    114         1.0000000
508    114         1.0000000
509    114         1.0000000
510    114         1.0000000
511    114         1.0000000
512    114         1.0000000
513    114         1.0000000
514    124         1.0000000
515    124         1.0000000
516    124         1.0000000
517    124         1.0000000
518    124         1.0000000
519    124         1.0000000
520    124         1.0000000
521    114         1.0000000
522    124         1.0000000
523    124         1.0000000
524    126         1.0000000
525     40         1.0000000
526     40         1.0000000
527     40         1.0000000
528     40         1.0000000
529     40         1.0000000
530     40         1.0000000
531     40         1.0000000
532     30         1.0000000
533     30         1.0000000
534     40         1.0000000
535     40         1.0000000
536    114         1.0000000
537    114         1.0000000
538    114         1.0000000
539    114         1.0000000
540    114         1.0000000
541    114         1.0000000
542    114         1.0000000
543    114         1.0000000
544    114         1.0000000
545    114         1.0000000
546    114         1.0000000
547    114         1.0000000
548    114         1.0000000
549    114         1.0000000
550    114         1.0000000
551    114         1.0000000
552    114         1.0000000
553    114         1.0000000
554    114         1.0000000
555    114         1.0000000
556    114         1.0000000
557    114         1.0000000
558    114         1.0000000
559    114         1.0000000
560    114         0.9380544
561    114         0.9309964
562    114         1.0000000
563    114         1.0000000
564    126         1.0000000
565    124         1.0000000
566    114         1.0000000
567    114         1.0000000
568    124         1.0000000
569    114         1.0000000
570    114         1.0000000
571    114         1.0000000
572    124         1.0000000
573    124         1.0000000
574    124         1.0000000
575    124         1.0000000
576    124         1.0000000
577    124         1.0000000
578    114         1.0000000
579    114         1.0000000
580    126         1.0000000
581     40         1.0000000
582     40         1.0000000
583     40         1.0000000
584     40         1.0000000
585     40         1.0000000
586     40         1.0000000
587     40         1.0000000
588     30         1.0000000
589     30         1.0000000
590     40         1.0000000
591     40         1.0000000
592    114         1.0000000
593    114         1.0000000
594    114         1.0000000
595    114         1.0000000
596    114         1.0000000
597    114         1.0000000
598    114         1.0000000
599    114         1.0000000
600    114         1.0000000
601    114         1.0000000
602    114         1.0000000
603    114         1.0000000
604    114         1.0000000
605    114         1.0000000
606    114         1.0000000
607    114         1.0000000
608    114         1.0000000
609    114         1.0000000
610    114         1.0000000
611    114         1.0000000
612    114         1.0000000
613    114         1.0000000
614    114         1.0000000
615    114         1.0000000
616    114         0.9380544
617    114         0.9309964
618    114         1.0000000
619    114         1.0000000
620    126         1.0000000
621    126         1.0000000
622    124         1.0000000
623    124         1.0000000
624     30         1.0000000
625    114         1.0000000
626    124         1.0000000
627    124         1.0000000
628    124         1.0000000
629    124         1.0000000
630    124         1.0000000
631     30         1.0000000
632     30         1.0000000
633    114         1.0000000
634    114         1.0000000
635    114         1.0000000
636     20         1.0000000
637     40         1.0000000
638     40         1.0000000
639     40         1.0000000
640     40         1.0000000
641     40         1.0000000
642     40         1.0000000
643     40         1.0000000
644     30         1.0000000
645     30         1.0000000
646     40         1.0000000
647     40         1.0000000
648    114         1.0000000
649    114         1.0000000
650    114         1.0000000
651    114         1.0000000
652    114         1.0000000
653    114         1.0000000
654    114         1.0000000
655    114         1.0000000
656    114         1.0000000
657    114         1.0000000
658    114         1.0000000
659    114         1.0000000
660    114         1.0000000
661    114         1.0000000
662    114         1.0000000
663    114         1.0000000
664    114         1.0000000
665    114         1.0000000
666    114         1.0000000
667    114         1.0000000
668    114         1.0000000
669    114         1.0000000
670    114         1.0000000
671    114         1.0000000
672    114         0.9380544
673    116         0.9309964
674    116         1.0000000
675    114         1.0000000
676    114         1.0000000
677    114         1.0000000
678    124         1.0000000
679    124         1.0000000
680     30         1.0000000
681     30         1.0000000
682     30         1.0000000
683     30         1.0000000
684     30         1.0000000
685     30         1.0000000
686     30         1.0000000
687     30         1.0000000
688     30         1.0000000
689     30         1.0000000
690    114         1.0000000
691    114         1.0000000
692    126         1.0000000
693     40         1.0000000
694     40         1.0000000
695     40         1.0000000
696     40         1.0000000
697     40         1.0000000
698     40         1.0000000
699     40         1.0000000
700     40         1.0000000
701     30         1.0000000
702     30         1.0000000
703     40         1.0000000
704    114         1.0000000
705    114         1.0000000
706    124         1.0000000
707    124         1.0000000
708    114         1.0000000
709    114         1.0000000
710    114         1.0000000
711    114         1.0000000
712    114         1.0000000
713    114         1.0000000
714    114         1.0000000
715    114         1.0000000
716    114         1.0000000
717    114         1.0000000
718    114         1.0000000
719    114         1.0000000
720    114         1.0000000
721    114         1.0000000
722    114         1.0000000
723    114         1.0000000
724    114         1.0000000
725    114         1.0000000
726    114         1.0000000
727    114         1.0000000
728    114         0.9380544
729    114         0.9309964
730    114         1.0000000
731    114         1.0000000
732    114         1.0000000
733    114         1.0000000
734    114         1.0000000
735    114         1.0000000
736    114         1.0000000
737    114         1.0000000
738    114         1.0000000
739     30         1.0000000
740     30         1.0000000
741     30         1.0000000
742     30         1.0000000
743     30         1.0000000
744     30         1.0000000
745     30         1.0000000
746     30         1.0000000
747     30         1.0000000
748     40         1.0000000
749     40         1.0000000
750     40         1.0000000
751     40         1.0000000
752     40         1.0000000
753     40         1.0000000
754     40         1.0000000
755     40         1.0000000
756     40         1.0000000
757     40         1.0000000
758     40         1.0000000
759    126         1.0000000
760    114         1.0000000
761    114         1.0000000
762    114         1.0000000
763    114         1.0000000
764    116         1.0000000
765    116         1.0000000
766    114         1.0000000
767    114         1.0000000
768    114         1.0000000
769    114         1.0000000
770    114         1.0000000
771    114         1.0000000
772    114         1.0000000
773    114         1.0000000
774    114         1.0000000
775    114         1.0000000
776    114         1.0000000
777    114         1.0000000
778    114         1.0000000
779    114         1.0000000
780    114         1.0000000
781    114         1.0000000
782    114         1.0000000
783    114         1.0000000
784    114         0.9380544
785    114         0.9309964
786    114         1.0000000
787    114         1.0000000
788    114         1.0000000
789    124         1.0000000
790    124         1.0000000
791    124         1.0000000
792    124         1.0000000
793    124         1.0000000
794    124         1.0000000
795    124         1.0000000
796    124         1.0000000
797    124         1.0000000
798     30         1.0000000
799     30         1.0000000
800     30         1.0000000
801     30         1.0000000
802     30         1.0000000
803     30         1.0000000
804    126         1.0000000
805     40         1.0000000
806     40         1.0000000
807     40         1.0000000
808     40         1.0000000
809     40         1.0000000
810     30         1.0000000
811     30         1.0000000
812     20         1.0000000
813     90         1.0000000
814     90         1.0000000
815    124         1.0000000
816    114         1.0000000
817    114         1.0000000
818    114         1.0000000
819    114         1.0000000
820     30         1.0000000
821    126         1.0000000
822    114         1.0000000
823    114         1.0000000
824    114         1.0000000
825    114         1.0000000
826    114         1.0000000
827    114         1.0000000
828    114         1.0000000
829    114         1.0000000
830    114         1.0000000
831    114         1.0000000
832    114         1.0000000
833    114         1.0000000
834    114         1.0000000
835    114         1.0000000
836    114         1.0000000
837    114         1.0000000
838    116         1.0000000
839    116         1.0000000
840    114         0.9380544
841    114         0.9309964
842    114         1.0000000
843    114         1.0000000
844    114         1.0000000
845    126         1.0000000
846    126         1.0000000
847    126         1.0000000
848    116         1.0000000
849    124         1.0000000
850    124         1.0000000
851    124         1.0000000
852    124         1.0000000
853    124         1.0000000
854     30         1.0000000
855     30         1.0000000
856     30         1.0000000
857     30         1.0000000
858     30         1.0000000
859     30         1.0000000
860     40         1.0000000
861     40         1.0000000
862     40         1.0000000
863     40         1.0000000
864    126         1.0000000
865     40         1.0000000
866    126         1.0000000
867    126         1.0000000
868     20         1.0000000
869     90         1.0000000
870     90         1.0000000
871    114         1.0000000
872    124         1.0000000
873    114         1.0000000
874    114         1.0000000
875    114         1.0000000
876    114         1.0000000
877    124         1.0000000
878    114         1.0000000
879    114         1.0000000
880    114         1.0000000
881    114         1.0000000
882    114         1.0000000
883    114         1.0000000
884    114         1.0000000
885    114         1.0000000
886    114         1.0000000
887    114         1.0000000
888    114         1.0000000
889    114         1.0000000
890    114         1.0000000
891    114         1.0000000
892    114         1.0000000
893    114         1.0000000
894    114         1.0000000
895    114         1.0000000
896    114         0.9380544
897    114         0.9309964
898    114         1.0000000
899    114         1.0000000
900    116         1.0000000
901    124         1.0000000
902    126         1.0000000
903    126         1.0000000
904     30         1.0000000
905    126         1.0000000
906    126         1.0000000
907     30         1.0000000
908     30         1.0000000
909    116         1.0000000
910     30         1.0000000
911     30         1.0000000
912     30         1.0000000
913     30         1.0000000
914     30         1.0000000
915     30         1.0000000
916     40         1.0000000
917     20         1.0000000
918     40         1.0000000
919     40         1.0000000
920     40         1.0000000
921     40         1.0000000
922     40         1.0000000
923     40         1.0000000
924     40         1.0000000
925    126         1.0000000
926    126         1.0000000
927    114         1.0000000
928    114         1.0000000
929    114         1.0000000
930    114         1.0000000
931    114         1.0000000
932    114         1.0000000
933    114         1.0000000
934    114         1.0000000
935    114         1.0000000
936    114         1.0000000
937    114         1.0000000
938    114         1.0000000
939    114         1.0000000
940    114         1.0000000
941    114         1.0000000
942    114         1.0000000
943    114         1.0000000
944    114         1.0000000
945    114         1.0000000
946    114         1.0000000
947    114         1.0000000
948    114         1.0000000
949    114         1.0000000
950    114         1.0000000
951    114         1.0000000
952    114         0.9380544
953    126         0.9309964
954    126         1.0000000
955    126         1.0000000
956    116         1.0000000
957    116         1.0000000
958    124         1.0000000
959    124         1.0000000
960     40         1.0000000
961     40         1.0000000
962     40         1.0000000
963     40         1.0000000
964     40         1.0000000
965     30         1.0000000
966     30         1.0000000
967     30         1.0000000
968     30         1.0000000
969     40         1.0000000
970     40         1.0000000
971     30         1.0000000
972     20         1.0000000
973     20         1.0000000
974     40         1.0000000
975     40         1.0000000
976     40         1.0000000
977     40         1.0000000
978     20         1.0000000
979     20         1.0000000
980     40         1.0000000
981    126         1.0000000
982    126         1.0000000
983    114         1.0000000
984    114         1.0000000
985    114         1.0000000
986    114         1.0000000
987    114         1.0000000
988    114         1.0000000
989    114         1.0000000
990    114         1.0000000
991    114         1.0000000
992    114         1.0000000
993    114         1.0000000
994    114         1.0000000
995    114         1.0000000
996    124         1.0000000
997    114         1.0000000
998    114         1.0000000
999    114         1.0000000
1000   114         1.0000000
1001   114         1.0000000
1002   114         1.0000000
1003   114         1.0000000
1004   114         1.0000000
1005   114         1.0000000
1006   114         1.0000000
1007   114         1.0000000
1008   114         0.9380544
1009   126         0.9309964
1010   126         1.0000000
1011   126         1.0000000
1012   116         1.0000000
1013   116         1.0000000
1014   124         1.0000000
1015   124         1.0000000
1016    40         1.0000000
1017    40         1.0000000
1018    40         1.0000000
1019    40         1.0000000
1020    40         1.0000000
1021    30         1.0000000
1022    30         1.0000000
1023    40         1.0000000
1024    40         1.0000000
1025    40         1.0000000
1026    40         1.0000000
1027    20         1.0000000
1028    20         1.0000000
1029    40         1.0000000
1030    40         1.0000000
1031   126         1.0000000
1032   126         1.0000000
1033    20         1.0000000
1034   126         1.0000000
1035   126         1.0000000
1036    90         1.0000000
1037   126         1.0000000
1038   126         1.0000000
1039   114         1.0000000
1040   114         1.0000000
1041   114         1.0000000
1042   114         1.0000000
1043   114         1.0000000
1044   114         1.0000000
1045   114         1.0000000
1046   114         1.0000000
1047   114         1.0000000
1048   114         1.0000000
1049   114         1.0000000
1050   114         1.0000000
1051   114         1.0000000
1052   114         1.0000000
1053   114         1.0000000
1054   114         1.0000000
1055   114         1.0000000
1056   114         1.0000000
1057   114         1.0000000
1058   114         1.0000000
1059   116         1.0000000
1060   114         1.0000000
1061   114         1.0000000
1062   114         1.0000000
1063   114         1.0000000
1064   114         0.9380544
1065   126         0.9309964
1066   126         1.0000000
1067    40         1.0000000
1068   126         1.0000000
1069   116         1.0000000
1070   114         1.0000000
1071   114         1.0000000
1072    20         1.0000000
1073    40         1.0000000
1074    40         1.0000000
1075    40         1.0000000
1076    40         1.0000000
1077    30         1.0000000
1078    30         1.0000000
1079    40         1.0000000
1080    40         1.0000000
1081    40         1.0000000
1082    40         1.0000000
1083    20         1.0000000
1084    20         1.0000000
1085    40         1.0000000
1086    40         1.0000000
1087   126         1.0000000
1088   126         1.0000000
1089    40         1.0000000
1090    40         1.0000000
1091    40         1.0000000
1092    90         1.0000000
1093   116         1.0000000
1094   116         1.0000000
1095   114         1.0000000
1096   114         1.0000000
1097   114         1.0000000
1098   114         1.0000000
1099   114         1.0000000
1100   114         1.0000000
1101   114         1.0000000
1102   114         1.0000000
1103   114         1.0000000
1104   114         1.0000000
1105   114         1.0000000
1106   114         1.0000000
1107   114         1.0000000
1108   114         1.0000000
1109   114         1.0000000
1110   114         1.0000000
1111   114         1.0000000
1112   114         1.0000000
1113   114         1.0000000
1114   114         1.0000000
1115   114         1.0000000
1116   114         1.0000000
1117   114         1.0000000
1118   114         1.0000000
1119   114         1.0000000
1120   114         0.9380544
1121   126         0.9309964
1122   126         1.0000000
1123   126         1.0000000
1124    40         1.0000000
1125   126         1.0000000
1126   114         1.0000000
1127   114         1.0000000
1128    40         1.0000000
1129    40         1.0000000
1130    40         1.0000000
1131    40         1.0000000
1132    30         1.0000000
1133    40         1.0000000
1134    40         1.0000000
1135    40         1.0000000
1136    40         1.0000000
1137   126         1.0000000
1138   126         1.0000000
1139   126         1.0000000
1140   126         1.0000000
1141    20         1.0000000
1142    20         1.0000000
1143    40         1.0000000
1144    40         1.0000000
1145    40         1.0000000
1146    40         1.0000000
1147    40         1.0000000
1148    90         1.0000000
1149   116         1.0000000
1150   116         1.0000000
1151   114         1.0000000
1152   114         1.0000000
1153   114         1.0000000
1154   114         1.0000000
1155   114         1.0000000
1156   114         1.0000000
1157   114         1.0000000
1158   114         1.0000000
1159   114         1.0000000
1160   114         1.0000000
1161   114         1.0000000
1162   114         1.0000000
1163   114         1.0000000
1164   114         1.0000000
1165   114         1.0000000
1166   114         1.0000000
1167   114         1.0000000
1168   114         1.0000000
1169   114         1.0000000
1170   114         1.0000000
1171   114         1.0000000
1172   114         1.0000000
1173   114         1.0000000
1174   114         1.0000000
1175   114         1.0000000
1176   114         0.9380544
1177    30         0.9309964
1178    30         1.0000000
1179    30         1.0000000
1180    40         1.0000000
1181   126         1.0000000
1182   114         1.0000000
1183   114         1.0000000
1184    30         1.0000000
1185    40         1.0000000
1186    40         1.0000000
1187    40         1.0000000
1188    40         1.0000000
1189    40         1.0000000
1190   126         1.0000000
1191   124         1.0000000
1192   114         1.0000000
1193   116         1.0000000
1194   116         1.0000000
1195   114         1.0000000
1196   124         1.0000000
1197   126         1.0000000
1198    30         1.0000000
1199    40         1.0000000
1200    40         1.0000000
1201    40         1.0000000
1202    90         1.0000000
1203    90         1.0000000
1204    90         1.0000000
1205   114         1.0000000
1206   114         1.0000000
1207   114         1.0000000
1208   114         1.0000000
1209   114         1.0000000
1210   114         1.0000000
1211   114         1.0000000
1212   114         1.0000000
1213   114         1.0000000
1214   114         1.0000000
1215   114         1.0000000
1216   114         1.0000000
1217   114         1.0000000
1218   114         1.0000000
1219   114         1.0000000
1220   114         1.0000000
1221   114         1.0000000
1222   114         1.0000000
1223   114         1.0000000
1224   114         1.0000000
1225   114         1.0000000
1226   114         1.0000000
1227   114         1.0000000
1228   114         1.0000000
1229   114         1.0000000
1230   114         1.0000000
1231   114         1.0000000
1232   114         0.9380544
1233    30         0.9309964
1234    30         1.0000000
1235    30         1.0000000
1236    40         1.0000000
1237    50         1.0000000
1238    40         1.0000000
1239    40         1.0000000
1240    30         1.0000000
1241    40         1.0000000
1242    40         1.0000000
1243    40         1.0000000
1244    20         1.0000000
1245   126         1.0000000
1246   114         1.0000000
1247   114         1.0000000
1248   114         1.0000000
1249   114         1.0000000
1250   114         1.0000000
1251   114         1.0000000
1252   124         1.0000000
1253    30         1.0000000
1254    30         1.0000000
1255    40         1.0000000
1256    40         1.0000000
1257    30         1.0000000
1258    90         1.0000000
1259    90         1.0000000
1260   126         1.0000000
1261   114         1.0000000
1262   114         1.0000000
1263   114         1.0000000
1264   114         1.0000000
1265   114         1.0000000
1266   114         1.0000000
1267   114         1.0000000
1268   114         1.0000000
1269   114         1.0000000
1270   114         1.0000000
1271   114         1.0000000
1272   114         1.0000000
1273   114         1.0000000
1274   114         1.0000000
1275   114         1.0000000
1276   114         1.0000000
1277   114         1.0000000
1278   114         1.0000000
1279   114         1.0000000
1280   114         1.0000000
1281   114         1.0000000
1282   114         1.0000000
1283   114         1.0000000
1284   114         1.0000000
1285   114         1.0000000
1286   114         1.0000000
1287   114         1.0000000
1288   114         0.9380544
1289    30         0.9309964
1290    30         1.0000000
1291    30         1.0000000
1292    40         1.0000000
1293    50         1.0000000
1294    40         1.0000000
1295    40         1.0000000
1296    20         1.0000000
1297   126         1.0000000
1298   126         1.0000000
1299   114         1.0000000
1300   114         1.0000000
1301   114         1.0000000
1302   114         1.0000000
1303   114         1.0000000
1304   114         1.0000000
1305   124         1.0000000
1306   124         1.0000000
1307   124         1.0000000
1308    30         1.0000000
1309    30         1.0000000
1310    40         1.0000000
1311   126         1.0000000
1312    20         1.0000000
1313    90         1.0000000
1314    90         1.0000000
1315    30         1.0000000
1316    40         1.0000000
1317   114         1.0000000
1318   114         1.0000000
1319   114         1.0000000
1320   114         1.0000000
1321   114         1.0000000
1322   114         1.0000000
1323   114         1.0000000
1324   114         1.0000000
1325   114         1.0000000
1326   114         1.0000000
1327   114         1.0000000
1328   114         1.0000000
1329   114         1.0000000
1330   114         1.0000000
1331   114         1.0000000
1332   116         1.0000000
1333   116         1.0000000
1334   116         1.0000000
1335   114         1.0000000
1336   116         1.0000000
1337   114         1.0000000
1338   114         1.0000000
1339   114         1.0000000
1340   114         1.0000000
1341   114         1.0000000
1342   114         1.0000000
1343   114         1.0000000
1344   114         0.9380544
1345    30         0.9309964
1346    40         1.0000000
1347    40         1.0000000
1348    50         1.0000000
1349    40         1.0000000
1350    40         1.0000000
1351    20         1.0000000
1352    40         1.0000000
1353   126         1.0000000
1354   126         1.0000000
1355   114         1.0000000
1356   114         1.0000000
1357   114         1.0000000
1358   114         1.0000000
1359   114         1.0000000
1360   114         1.0000000
1361   114         1.0000000
1362   114         1.0000000
1363   114         1.0000000
1364    30         1.0000000
1365    40         1.0000000
1366    30         1.0000000
1367    90         1.0000000
1368    30         1.0000000
1369    30         1.0000000
1370    30         1.0000000
1371   126         1.0000000
1372    90         1.0000000
1373    30         1.0000000
1374    90         1.0000000
1375    90         1.0000000
1376   114         1.0000000
1377   114         1.0000000
1378   114         1.0000000
1379   114         1.0000000
1380   114         1.0000000
1381   114         1.0000000
1382   114         1.0000000
1383   114         1.0000000
1384   114         1.0000000
1385   114         1.0000000
1386   114         1.0000000
1387   114         1.0000000
1388   116         1.0000000
1389   114         1.0000000
1390   114         1.0000000
1391   116         1.0000000
1392   116         1.0000000
1393   114         1.0000000
1394   114         1.0000000
1395   114         1.0000000
1396   114         1.0000000
1397   114         1.0000000
1398   114         1.0000000
1399   114         1.0000000
1400   114         0.9380544
1401    40         0.9309964
1402    40         1.0000000
1403    40         1.0000000
1404    40         1.0000000
1405    20         1.0000000
1406    20         1.0000000
1407    40         1.0000000
1408   126         1.0000000
1409   114         1.0000000
1410   114         1.0000000
1411   114         1.0000000
1412   114         1.0000000
1413   114         1.0000000
1414   114         1.0000000
1415   114         1.0000000
1416   114         1.0000000
1417   114         1.0000000
1418   114         1.0000000
1419   114         1.0000000
1420    30         1.0000000
1421    20         1.0000000
1422    20         1.0000000
1423    40         1.0000000
1424    40         1.0000000
1425   126         1.0000000
1426   126         1.0000000
1427    40         1.0000000
1428    30         1.0000000
1429    20         1.0000000
1430    30         1.0000000
1431    90         1.0000000
1432   114         1.0000000
1433   114         1.0000000
1434   114         1.0000000
1435   114         1.0000000
1436   114         1.0000000
1437   114         1.0000000
1438   114         1.0000000
1439   114         1.0000000
1440   114         1.0000000
1441   114         1.0000000
1442   114         1.0000000
1443   114         1.0000000
1444   114         1.0000000
1445   114         1.0000000
1446   114         1.0000000
1447   116         1.0000000
1448   116         1.0000000
1449   114         1.0000000
1450   114         1.0000000
1451   114         1.0000000
1452   114         1.0000000
1453   114         1.0000000
1454   114         1.0000000
1455   114         1.0000000
1456   114         0.9380544
1457    20         0.9309964
1458    30         1.0000000
1459    20         1.0000000
1460    20         1.0000000
1461    40         1.0000000
1462    40         1.0000000
1463    20         1.0000000
1464   126         1.0000000
1465   114         1.0000000
1466   114         1.0000000
1467   114         1.0000000
1468   114         1.0000000
1469   114         1.0000000
1470   114         1.0000000
1471   114         1.0000000
1472   114         1.0000000
1473   114         1.0000000
1474   114         1.0000000
1475   114         1.0000000
1476    40         1.0000000
1477    20         1.0000000
1478    40         1.0000000
1479    30         1.0000000
1480    40         1.0000000
1481   126         1.0000000
1482   126         1.0000000
1483    90         1.0000000
1484    40         1.0000000
1485   126         1.0000000
1486    20         1.0000000
1487    90         1.0000000
1488   126         1.0000000
1489   114         1.0000000
1490   116         1.0000000
1491   116         1.0000000
1492   114         1.0000000
1493   114         1.0000000
1494   114         1.0000000
1495   114         1.0000000
1496   114         1.0000000
1497   114         1.0000000
1498   114         1.0000000
1499   114         1.0000000
1500   114         1.0000000
1501   114         1.0000000
1502   114         1.0000000
1503   114         1.0000000
1504   116         1.0000000
1505   114         1.0000000
1506   114         1.0000000
1507   114         1.0000000
1508   114         1.0000000
1509   114         1.0000000
1510   114         1.0000000
1511   114         1.0000000
1512   114         0.9380544
1513    40         0.9309964
1514    40         1.0000000
1515    40         1.0000000
1516    40         1.0000000
1517   126         1.0000000
1518   126         1.0000000
1519   116         1.0000000
1520   114         1.0000000
1521   114         1.0000000
1522   114         1.0000000
1523   114         1.0000000
1524   114         1.0000000
1525   114         1.0000000
1526   124         1.0000000
1527   124         1.0000000
1528   124         1.0000000
1529   114         1.0000000
1530   114         1.0000000
1531   114         1.0000000
1532    90         1.0000000
1533   126         1.0000000
1534    30         1.0000000
1535    30         1.0000000
1536    20         1.0000000
1537    90         1.0000000
1538    90         1.0000000
1539    40         1.0000000
1540   126         1.0000000
1541   114         1.0000000
1542   124         1.0000000
1543    40         1.0000000
1544    40         1.0000000
1545   114         1.0000000
1546   114         1.0000000
1547   114         1.0000000
1548   114         1.0000000
1549   114         1.0000000
1550   114         1.0000000
1551   114         1.0000000
1552   114         1.0000000
1553   114         1.0000000
1554   114         1.0000000
1555   114         1.0000000
1556   114         1.0000000
1557   114         1.0000000
1558   114         1.0000000
1559   114         1.0000000
1560   116         1.0000000
1561   114         1.0000000
1562   114         1.0000000
1563   114         1.0000000
1564   114         1.0000000
1565   114         1.0000000
1566   114         1.0000000
1567   114         1.0000000
1568   114         0.9380544
1569    40         0.9309964
1570    40         1.0000000
1571    40         1.0000000
1572    40         1.0000000
1573   126         1.0000000
1574   126         1.0000000
1575   116         1.0000000
1576   114         1.0000000
1577   114         1.0000000
1578   114         1.0000000
1579   114         1.0000000
1580   114         1.0000000
1581   114         1.0000000
1582   124         1.0000000
1583   114         1.0000000
1584   114         1.0000000
1585   114         1.0000000
1586   114         1.0000000
1587   114         1.0000000
1588    40         1.0000000
1589    40         1.0000000
1590    30         1.0000000
1591    30         1.0000000
1592    20         1.0000000
1593    20         1.0000000
1594    20         1.0000000
1595    40         1.0000000
1596   126         1.0000000
1597   116         1.0000000
1598   114         1.0000000
1599    40         1.0000000
1600    20         1.0000000
1601   116         1.0000000
1602   116         1.0000000
1603   114         1.0000000
1604   116         1.0000000
1605   114         1.0000000
1606   114         1.0000000
1607   114         1.0000000
1608   114         1.0000000
1609   114         1.0000000
1610   114         1.0000000
1611   114         1.0000000
1612   114         1.0000000
1613   114         1.0000000
1614   114         1.0000000
1615   114         1.0000000
1616   114         1.0000000
1617   114         1.0000000
1618   114         1.0000000
1619   114         1.0000000
1620   114         1.0000000
1621   114         1.0000000
1622   114         1.0000000
1623   114         1.0000000
1624   114         0.9380544
1625    40         0.9309964
1626    40         1.0000000
1627    40         1.0000000
1628   126         1.0000000
1629   124         1.0000000
1630   124         1.0000000
1631   114         1.0000000
1632   114         1.0000000
1633   114         1.0000000
1634   114         1.0000000
1635   124         1.0000000
1636   114         1.0000000
1637   114         1.0000000
1638   114         1.0000000
1639   114         1.0000000
1640   114         1.0000000
1641   114         1.0000000
1642   114         1.0000000
1643   114         1.0000000
1644    40         1.0000000
1645    40         1.0000000
1646    30         1.0000000
1647    30         1.0000000
1648    20         1.0000000
1649    20         1.0000000
1650    20         1.0000000
1651    40         1.0000000
1652   114         1.0000000
1653   124         1.0000000
1654   124         1.0000000
1655   126         1.0000000
1656    40         1.0000000
1657   126         1.0000000
1658   126         1.0000000
1659   114         1.0000000
1660   114         1.0000000
1661   114         1.0000000
1662   114         1.0000000
1663   114         1.0000000
1664   114         1.0000000
1665   114         1.0000000
1666   114         1.0000000
1667   114         1.0000000
1668   116         1.0000000
1669   116         1.0000000
1670   116         1.0000000
1671   116         1.0000000
1672   116         1.0000000
1673   114         1.0000000
1674   114         1.0000000
1675   114         1.0000000
1676   114         1.0000000
1677   114         1.0000000
1678   114         1.0000000
1679   114         1.0000000
1680   114         0.9380544
1681    40         0.9309964
1682    40         1.0000000
1683   126         1.0000000
1684   114         1.0000000
1685   114         1.0000000
1686   114         1.0000000
1687   114         1.0000000
1688   114         1.0000000
1689   124         1.0000000
1690   124         1.0000000
1691   114         1.0000000
1692   114         1.0000000
1693   114         1.0000000
1694   114         1.0000000
1695   114         1.0000000
1696   114         1.0000000
1697   114         1.0000000
1698   114         1.0000000
1699   114         1.0000000
1700    40         1.0000000
1701    40         1.0000000
1702    40         1.0000000
1703    40         1.0000000
1704    90         1.0000000
1705    20         1.0000000
1706    20         1.0000000
1707   126         1.0000000
1708   114         1.0000000
1709   124         1.0000000
1710   124         1.0000000
1711   126         1.0000000
1712    40         1.0000000
1713   126         1.0000000
1714   126         1.0000000
1715   114         1.0000000
1716   114         1.0000000
1717   114         1.0000000
1718   114         1.0000000
1719   114         1.0000000
1720   114         1.0000000
1721   114         1.0000000
1722   114         1.0000000
1723   114         1.0000000
1724   116         1.0000000
1725   116         1.0000000
1726   116         1.0000000
1727   116         1.0000000
1728   116         1.0000000
1729   114         1.0000000
1730   114         1.0000000
1731   114         1.0000000
1732   114         1.0000000
1733   114         1.0000000
1734   114         1.0000000
1735   114         1.0000000
1736   114         0.9380544
1737    40         0.9309964
1738    40         1.0000000
1739   126         1.0000000
1740   114         1.0000000
1741   114         1.0000000
1742   114         1.0000000
1743   126         1.0000000
1744   126         1.0000000
1745    30         1.0000000
1746    30         1.0000000
1747   124         1.0000000
1748   114         1.0000000
1749   114         1.0000000
1750   114         1.0000000
1751   114         1.0000000
1752   114         1.0000000
1753   114         1.0000000
1754   114         1.0000000
1755   126         1.0000000
1756    40         1.0000000
1757    30         1.0000000
1758    90         1.0000000
1759    90         1.0000000
1760    30         1.0000000
1761    40         1.0000000
1762    40         1.0000000
1763   126         1.0000000
1764   126         1.0000000
1765   114         1.0000000
1766   114         1.0000000
1767   114         1.0000000
1768    40         1.0000000
1769   126         1.0000000
1770   126         1.0000000
1771   114         1.0000000
1772   116         1.0000000
1773   114         1.0000000
1774   114         1.0000000
1775   114         1.0000000
1776   114         1.0000000
1777   114         1.0000000
1778   114         1.0000000
1779   114         1.0000000
1780   116         1.0000000
1781   116         1.0000000
1782   116         1.0000000
1783   116         1.0000000
1784   116         1.0000000
1785   114         1.0000000
1786   114         1.0000000
1787   114         1.0000000
1788   114         1.0000000
1789   114         1.0000000
1790   114         1.0000000
1791   114         1.0000000
1792   114         0.9380544
1793   126         0.9309964
1794   126         1.0000000
1795   124         1.0000000
1796   114         1.0000000
1797   114         1.0000000
1798   114         1.0000000
1799   126         1.0000000
1800   126         1.0000000
1801    30         1.0000000
1802    30         1.0000000
1803   126         1.0000000
1804   114         1.0000000
1805   114         1.0000000
1806   114         1.0000000
1807   124         1.0000000
1808   114         1.0000000
1809   114         1.0000000
1810   114         1.0000000
1811   126         1.0000000
1812   126         1.0000000
1813    40         1.0000000
1814    20         1.0000000
1815    20         1.0000000
1816    20         1.0000000
1817   126         1.0000000
1818   126         1.0000000
1819   114         1.0000000
1820   114         1.0000000
1821   114         1.0000000
1822   114         1.0000000
1823   114         1.0000000
1824    40         1.0000000
1825   126         1.0000000
1826   126         1.0000000
1827   114         1.0000000
1828   116         1.0000000
1829   114         1.0000000
1830   114         1.0000000
1831   114         1.0000000
1832   114         1.0000000
1833   114         1.0000000
1834   114         1.0000000
1835   114         1.0000000
1836   116         1.0000000
1837   116         1.0000000
1838   116         1.0000000
1839   116         1.0000000
1840   114         1.0000000
1841   114         1.0000000
1842   114         1.0000000
1843   114         1.0000000
1844   114         1.0000000
1845   114         1.0000000
1846   114         1.0000000
1847   114         1.0000000
1848   114         0.9380544
1849   126         0.9309964
1850   126         1.0000000
1851   116         1.0000000
1852   126         1.0000000
1853   124         1.0000000
1854   124         1.0000000
1855   114         1.0000000
1856   124         1.0000000
1857   124         1.0000000
1858   124         1.0000000
1859   124         1.0000000
1860   124         1.0000000
1861   114         1.0000000
1862   114         1.0000000
1863   124         1.0000000
1864   114         1.0000000
1865   114         1.0000000
1866   114         1.0000000
1867   126         1.0000000
1868   126         1.0000000
1869   124         1.0000000
1870   124         1.0000000
1871   126         1.0000000
1872   124         1.0000000
1873   114         1.0000000
1874   114         1.0000000
1875   114         1.0000000
1876   114         1.0000000
1877   124         1.0000000
1878   114         1.0000000
1879   114         1.0000000
1880   126         1.0000000
1881   126         1.0000000
1882   126         1.0000000
1883   116         1.0000000
1884   114         1.0000000
1885   114         1.0000000
1886   114         1.0000000
1887   114         1.0000000
1888   114         1.0000000
1889   114         1.0000000
1890   114         1.0000000
1891   114         1.0000000
1892   116         1.0000000
1893   114         1.0000000
1894   114         1.0000000
1895   114         1.0000000
1896   114         1.0000000
1897   114         1.0000000
1898   114         1.0000000
1899   114         1.0000000
1900   114         1.0000000
1901   114         1.0000000
1902   114         1.0000000
1903   114         1.0000000
1904   114         0.9380544
1905   126         0.9309964
1906   124         1.0000000
1907   114         1.0000000
1908   116         1.0000000
1909   114         1.0000000
1910   114         1.0000000
1911   114         1.0000000
1912   114         1.0000000
1913   114         1.0000000
1914   114         1.0000000
1915   114         1.0000000
1916   114         1.0000000
1917   114         1.0000000
1918   114         1.0000000
1919   114         1.0000000
1920   114         1.0000000
1921   114         1.0000000
1922   114         1.0000000
1923   114         1.0000000
1924   114         1.0000000
1925   114         1.0000000
1926   114         1.0000000
1927   114         1.0000000
1928   114         1.0000000
1929   114         1.0000000
1930   114         1.0000000
1931   114         1.0000000
1932   114         1.0000000
1933   126         1.0000000
1934   124         1.0000000
1935   114         1.0000000
1936    40         1.0000000
1937    40         1.0000000
1938    40         1.0000000
1939   116         1.0000000
1940   116         1.0000000
1941   114         1.0000000
1942   114         1.0000000
1943   114         1.0000000
1944   114         1.0000000
1945   114         1.0000000
1946   114         1.0000000
1947   114         1.0000000
1948   114         1.0000000
1949   114         1.0000000
1950   114         1.0000000
1951   114         1.0000000
1952   114         1.0000000
1953   114         1.0000000
1954   114         1.0000000
1955   114         1.0000000
1956   114         1.0000000
1957   114         1.0000000
1958   114         1.0000000
1959   114         1.0000000
1960   114         0.9380544
1961   126         0.9309964
1962   126         1.0000000
1963   124         1.0000000
1964   124         1.0000000
1965   114         1.0000000
1966   114         1.0000000
1967   114         1.0000000
1968   114         1.0000000
1969   114         1.0000000
1970   114         1.0000000
1971   114         1.0000000
1972   114         1.0000000
1973   114         1.0000000
1974   114         1.0000000
1975   114         1.0000000
1976   114         1.0000000
1977   114         1.0000000
1978   114         1.0000000
1979   114         1.0000000
1980   114         1.0000000
1981   114         1.0000000
1982   114         1.0000000
1983   114         1.0000000
1984   114         1.0000000
1985   114         1.0000000
1986   114         1.0000000
1987   114         1.0000000
1988   114         1.0000000
1989   124         1.0000000
1990   124         1.0000000
1991   114         1.0000000
1992   126         1.0000000
1993    20         1.0000000
1994    20         1.0000000
1995    40         1.0000000
1996    90         1.0000000
1997    20         1.0000000
1998    20         1.0000000
1999   124         1.0000000
2000   114         1.0000000
2001   114         1.0000000
2002   114         1.0000000
2003   114         1.0000000
2004   114         1.0000000
2005   114         1.0000000
2006   114         1.0000000
2007   114         1.0000000
2008   114         1.0000000
2009   114         1.0000000
2010   114         1.0000000
2011   114         1.0000000
2012   114         1.0000000
2013   114         1.0000000
2014   114         1.0000000
2015   114         1.0000000
2016   114         0.9380544
2017   126         0.9309964
2018   126         1.0000000
2019   114         1.0000000
2020   114         1.0000000
2021   114         1.0000000
2022   114         1.0000000
2023   114         1.0000000
2024   114         1.0000000
2025   126         1.0000000
2026   126         1.0000000
2027   116         1.0000000
2028   114         1.0000000
2029   114         1.0000000
2030   114         1.0000000
2031   114         1.0000000
2032   114         1.0000000
2033   114         1.0000000
2034   114         1.0000000
2035   114         1.0000000
2036   114         1.0000000
2037   114         1.0000000
2038   114         1.0000000
2039   114         1.0000000
2040   114         1.0000000
2041   114         1.0000000
2042   114         1.0000000
2043   114         1.0000000
2044   114         1.0000000
2045   124         1.0000000
2046   126         1.0000000
2047   124         1.0000000
2048   114         1.0000000
2049    40         1.0000000
2050    40         1.0000000
2051    40         1.0000000
2052    40         1.0000000
2053    20         1.0000000
2054    20         1.0000000
2055    20         1.0000000
2056   126         1.0000000
2057   114         1.0000000
2058   114         1.0000000
2059   114         1.0000000
2060   114         1.0000000
2061   114         1.0000000
2062   114         1.0000000
2063   114         1.0000000
2064   114         1.0000000
2065   114         1.0000000
2066   114         1.0000000
2067   114         1.0000000
2068   114         1.0000000
2069   114         1.0000000
2070   114         1.0000000
2071   114         1.0000000
2072   114         0.9380544
2073   126         0.9309964
2074   126         1.0000000
2075   114         1.0000000
2076   114         1.0000000
2077   114         1.0000000
2078   114         1.0000000
2079   114         1.0000000
2080   114         1.0000000
2081   124         1.0000000
2082   126         1.0000000
2083   126         1.0000000
2084   114         1.0000000
2085   114         1.0000000
2086   114         1.0000000
2087   114         1.0000000
2088   114         1.0000000
2089   114         1.0000000
2090   114         1.0000000
2091   114         1.0000000
2092   114         1.0000000
2093   114         1.0000000
2094   114         1.0000000
2095   114         1.0000000
2096   114         1.0000000
2097   114         1.0000000
2098   114         1.0000000
2099   114         1.0000000
2100   114         1.0000000
2101   124         1.0000000
2102   126         1.0000000
2103   124         1.0000000
2104   114         1.0000000
2105   114         1.0000000
2106   114         1.0000000
2107    30         1.0000000
2108    30         1.0000000
2109   126         1.0000000
2110   126         1.0000000
2111   126         1.0000000
2112   126         1.0000000
2113   126         1.0000000
2114   126         1.0000000
2115   114         1.0000000
2116   114         1.0000000
2117   114         1.0000000
2118   114         1.0000000
2119   114         1.0000000
2120   114         1.0000000
2121   114         1.0000000
2122   114         1.0000000
2123   114         1.0000000
2124   114         1.0000000
2125   114         1.0000000
2126   114         1.0000000
2127   114         1.0000000
2128   114         0.9380544
2129   126         0.9309964
2130   126         1.0000000
2131   114         1.0000000
2132   114         1.0000000
2133   114         1.0000000
2134   114         1.0000000
2135   114         1.0000000
2136   114         1.0000000
2137   124         1.0000000
2138   126         1.0000000
2139   126         1.0000000
2140   114         1.0000000
2141   114         1.0000000
2142   114         1.0000000
2143   114         1.0000000
2144   114         1.0000000
2145   114         1.0000000
2146   116         1.0000000
2147   116         1.0000000
2148   114         1.0000000
2149   114         1.0000000
2150   114         1.0000000
2151   114         1.0000000
2152   114         1.0000000
2153   114         1.0000000
2154   114         1.0000000
2155   114         1.0000000
2156   114         1.0000000
2157   114         1.0000000
2158   124         1.0000000
2159   114         1.0000000
2160   114         1.0000000
2161   126         1.0000000
2162   126         1.0000000
2163    30         1.0000000
2164    30         1.0000000
2165    40         1.0000000
2166    40         1.0000000
2167    30         1.0000000
2168   126         1.0000000
2169    40         1.0000000
2170    40         1.0000000
2171   126         1.0000000
2172   114         1.0000000
2173   114         1.0000000
2174   114         1.0000000
2175   114         1.0000000
2176   114         1.0000000
2177   114         1.0000000
2178   114         1.0000000
2179   114         1.0000000
2180   114         1.0000000
2181   114         1.0000000
2182   114         1.0000000
2183   114         1.0000000
2184   114         0.9380544
2185   126         0.9309964
2186   126         1.0000000
2187   114         1.0000000
2188   114         1.0000000
2189   114         1.0000000
2190   114         1.0000000
2191   114         1.0000000
2192   114         1.0000000
2193   124         1.0000000
2194   126         1.0000000
2195   114         1.0000000
2196   114         1.0000000
2197   114         1.0000000
2198   114         1.0000000
2199   114         1.0000000
2200   116         1.0000000
2201   116         1.0000000
2202   116         1.0000000
2203   116         1.0000000
2204   114         1.0000000
2205   114         1.0000000
2206   114         1.0000000
2207   114         1.0000000
2208   114         1.0000000
2209   114         1.0000000
2210   114         1.0000000
2211   114         1.0000000
2212   114         1.0000000
2213   114         1.0000000
2214   124         1.0000000
2215   124         1.0000000
2216   114         1.0000000
2217   114         1.0000000
2218   114         1.0000000
2219    30         1.0000000
2220    40         1.0000000
2221    40         1.0000000
2222    40         1.0000000
2223    30         1.0000000
2224    30         1.0000000
2225    30         1.0000000
2226    30         1.0000000
2227    40         1.0000000
2228   114         1.0000000
2229   114         1.0000000
2230   114         1.0000000
2231   114         1.0000000
2232   114         1.0000000
2233   114         1.0000000
2234   114         1.0000000
2235   114         1.0000000
2236   114         1.0000000
2237   114         1.0000000
2238   114         1.0000000
2239   114         1.0000000
2240   114         0.9380544
2241   114         0.9309964
2242   114         1.0000000
2243   114         1.0000000
2244   114         1.0000000
2245   114         1.0000000
2246   114         1.0000000
2247   114         1.0000000
2248   114         1.0000000
2249   126         1.0000000
2250   126         1.0000000
2251   124         1.0000000
2252   124         1.0000000
2253   124         1.0000000
2254   124         1.0000000
2255   114         1.0000000
2256   114         1.0000000
2257   116         1.0000000
2258   116         1.0000000
2259   116         1.0000000
2260   126         1.0000000
2261   126         1.0000000
2262   126         1.0000000
2263   114         1.0000000
2264   114         1.0000000
2265   114         1.0000000
2266   114         1.0000000
2267   114         1.0000000
2268   114         1.0000000
2269   114         1.0000000
2270   114         1.0000000
2271   124         1.0000000
2272   114         1.0000000
2273   114         1.0000000
2274   114         1.0000000
2275    30         1.0000000
2276    40         1.0000000
2277    40         1.0000000
2278    40         1.0000000
2279    30         1.0000000
2280    30         1.0000000
2281    30         1.0000000
2282    30         1.0000000
2283    40         1.0000000
2284   126         1.0000000
2285   114         1.0000000
2286   114         1.0000000
2287   114         1.0000000
2288   114         1.0000000
2289   114         1.0000000
2290   124         1.0000000
2291   124         1.0000000
2292   114         1.0000000
2293   114         1.0000000
2294   114         1.0000000
2295   114         1.0000000
2296   114         0.9380544
2297   114         0.9309964
2298   114         1.0000000
2299   114         1.0000000
2300   114         1.0000000
2301   114         1.0000000
2302   114         1.0000000
2303   114         1.0000000
2304   114         1.0000000
2305   114         1.0000000
2306   124         1.0000000
2307   124         1.0000000
2308   114         1.0000000
2309   114         1.0000000
2310   114         1.0000000
2311   114         1.0000000
2312   114         1.0000000
2313    30         1.0000000
2314    30         1.0000000
2315    30         1.0000000
2316   126         1.0000000
2317   124         1.0000000
2318   124         1.0000000
2319   114         1.0000000
2320   114         1.0000000
2321   114         1.0000000
2322   114         1.0000000
2323   114         1.0000000
2324   114         1.0000000
2325   114         1.0000000
2326   114         1.0000000
2327   114         1.0000000
2328   114         1.0000000
2329   114         1.0000000
2330   114         1.0000000
2331    30         1.0000000
2332    40         1.0000000
2333    40         1.0000000
2334    40         1.0000000
2335    40         1.0000000
2336    40         1.0000000
2337   126         1.0000000
2338   126         1.0000000
2339    40         1.0000000
2340   126         1.0000000
2341   114         1.0000000
2342   114         1.0000000
2343   114         1.0000000
2344   114         1.0000000
2345   114         1.0000000
2346   124         1.0000000
2347   124         1.0000000
2348   114         1.0000000
2349   114         1.0000000
2350   114         1.0000000
2351   114         1.0000000
2352   114         0.9380544
2353   114         0.9309964
2354   114         1.0000000
2355   114         1.0000000
2356   114         1.0000000
2357   114         1.0000000
2358   114         1.0000000
2359   114         1.0000000
2360   114         1.0000000
2361   126         1.0000000
2362   126         1.0000000
2363   114         1.0000000
2364   114         1.0000000
2365   114         1.0000000
2366   114         1.0000000
2367   114         1.0000000
2368   114         1.0000000
2369    30         1.0000000
2370    30         1.0000000
2371    30         1.0000000
2372   126         1.0000000
2373   114         1.0000000
2374   114         1.0000000
2375   114         1.0000000
2376   114         1.0000000
2377   114         1.0000000
2378   114         1.0000000
2379   114         1.0000000
2380   114         1.0000000
2381   114         1.0000000
2382   114         1.0000000
2383   114         1.0000000
2384   114         1.0000000
2385   114         1.0000000
2386   114         1.0000000
2387    30         1.0000000
2388    40         1.0000000
2389    40         1.0000000
2390    40         1.0000000
2391    40         1.0000000
2392    40         1.0000000
2393    30         1.0000000
2394    30         1.0000000
2395    40         1.0000000
2396   126         1.0000000
2397   114         1.0000000
2398   114         1.0000000
2399   114         1.0000000
2400   114         1.0000000
2401   114         1.0000000
2402   114         1.0000000
2403   114         1.0000000
2404   114         1.0000000
2405   114         1.0000000
2406   114         1.0000000
2407   114         1.0000000
2408   114         0.9380544
2409   114         0.9309964
2410   114         1.0000000
2411   114         1.0000000
2412   114         1.0000000
2413   114         1.0000000
2414   114         1.0000000
2415   114         1.0000000
2416   114         1.0000000
2417   124         1.0000000
2418   114         1.0000000
2419   114         1.0000000
2420   114         1.0000000
2421   114         1.0000000
2422   114         1.0000000
2423   114         1.0000000
2424   114         1.0000000
2425   126         1.0000000
2426   126         1.0000000
2427    30         1.0000000
2428   126         1.0000000
2429   114         1.0000000
2430   114         1.0000000
2431   114         1.0000000
2432   114         1.0000000
2433   114         1.0000000
2434   114         1.0000000
2435   114         1.0000000
2436   114         1.0000000
2437   114         1.0000000
2438   114         1.0000000
2439   114         1.0000000
2440   114         1.0000000
2441   114         1.0000000
2442   114         1.0000000
2443    30         1.0000000
2444    40         1.0000000
2445    40         1.0000000
2446    30         1.0000000
2447    30         1.0000000
2448    30         1.0000000
2449    40         1.0000000
2450    40         1.0000000
2451    20         1.0000000
2452   126         1.0000000
2453   114         1.0000000
2454   114         1.0000000
2455   114         1.0000000
2456   114         1.0000000
2457   114         1.0000000
2458   114         1.0000000
2459    30         1.0000000
2460   114         1.0000000
2461   114         1.0000000
2462   114         1.0000000
2463   114         1.0000000
2464   114         0.9380544
2465   114         0.9309964
2466   114         1.0000000
2467   114         1.0000000
2468   114         1.0000000
2469   114         1.0000000
2470   114         1.0000000
2471   114         1.0000000
2472   114         1.0000000
2473   114         1.0000000
2474   114         1.0000000
2475   114         1.0000000
2476   116         1.0000000
2477   116         1.0000000
2478   116         1.0000000
2479   116         1.0000000
2480   114         1.0000000
2481   126         1.0000000
2482   126         1.0000000
2483   126         1.0000000
2484   126         1.0000000
2485   114         1.0000000
2486   114         1.0000000
2487   114         1.0000000
2488   114         1.0000000
2489   114         1.0000000
2490   114         1.0000000
2491   114         1.0000000
2492   114         1.0000000
2493   114         1.0000000
2494   114         1.0000000
2495   114         1.0000000
2496   114         1.0000000
2497   114         1.0000000
2498   114         1.0000000
2499   126         1.0000000
2500    30         1.0000000
2501    30         1.0000000
2502    30         1.0000000
2503    30         1.0000000
2504   126         1.0000000
2505    40         1.0000000
2506    40         1.0000000
2507    30         1.0000000
2508   126         1.0000000
2509   114         1.0000000
2510   114         1.0000000
2511   114         1.0000000
2512   114         1.0000000
2513   114         1.0000000
2514   114         1.0000000
2515   116         1.0000000
2516   114         1.0000000
2517   114         1.0000000
2518   114         1.0000000
2519   114         1.0000000
2520   114         0.9380544
2521   114         0.9309964
2522   114         1.0000000
2523   114         1.0000000
2524   114         1.0000000
2525   114         1.0000000
2526   114         1.0000000
2527   114         1.0000000
2528   114         1.0000000
2529   114         1.0000000
2530   114         1.0000000
2531   114         1.0000000
2532   116         1.0000000
2533   116         1.0000000
2534   116         1.0000000
2535   116         1.0000000
2536   114         1.0000000
2537   126         1.0000000
2538   126         1.0000000
2539   124         1.0000000
2540   126         1.0000000
2541   126         1.0000000
2542   126         1.0000000
2543   114         1.0000000
2544   114         1.0000000
2545   124         1.0000000
2546   124         1.0000000
2547   124         1.0000000
2548   114         1.0000000
2549   114         1.0000000
2550   114         1.0000000
2551   114         1.0000000
2552   114         1.0000000
2553   114         1.0000000
2554   114         1.0000000
2555   114         1.0000000
2556    30         1.0000000
2557    30         1.0000000
2558    30         1.0000000
2559    30         1.0000000
2560   126         1.0000000
2561    40         1.0000000
2562    40         1.0000000
2563    30         1.0000000
2564    20         1.0000000
2565   114         1.0000000
2566   114         1.0000000
2567   114         1.0000000
2568   114         1.0000000
2569   124         1.0000000
2570   124         1.0000000
2571   114         1.0000000
2572   114         1.0000000
2573   114         1.0000000
2574   114         1.0000000
2575   114         1.0000000
2576   114         0.9380544
2577   114         0.9309964
2578   114         1.0000000
2579   114         1.0000000
2580   114         1.0000000
2581   114         1.0000000
2582   114         1.0000000
2583   114         1.0000000
2584   114         1.0000000
2585   114         1.0000000
2586   114         1.0000000
2587   114         1.0000000
2588   114         1.0000000
2589   114         1.0000000
2590   114         1.0000000
2591   114         1.0000000
2592   124         1.0000000
2593   114         1.0000000
2594   114         1.0000000
2595   116         1.0000000
2596   124         1.0000000
2597   126         1.0000000
2598   126         1.0000000
2599   114         1.0000000
2600   124         1.0000000
2601   124         1.0000000
2602   124         1.0000000
2603   114         1.0000000
2604   124         1.0000000
2605   114         1.0000000
2606   114         1.0000000
2607   114         1.0000000
2608   114         1.0000000
2609   124         1.0000000
2610   124         1.0000000
2611   114         1.0000000
2612    30         1.0000000
2613    30         1.0000000
2614    30         1.0000000
2615    30         1.0000000
2616    30         1.0000000
2617    40         1.0000000
2618    40         1.0000000
2619    30         1.0000000
2620    30         1.0000000
2621   116         1.0000000
2622   116         1.0000000
2623   114         1.0000000
2624   114         1.0000000
2625   114         1.0000000
2626   114         1.0000000
2627   114         1.0000000
2628   114         1.0000000
2629   114         1.0000000
2630   114         1.0000000
2631   114         1.0000000
2632   114         0.9380544
2633   114         0.9309964
2634   114         1.0000000
2635   114         1.0000000
2636   114         1.0000000
2637   114         1.0000000
2638   114         1.0000000
2639   114         1.0000000
2640   114         1.0000000
2641   114         1.0000000
2642   114         1.0000000
2643   114         1.0000000
2644   114         1.0000000
2645   114         1.0000000
2646   114         1.0000000
2647   114         1.0000000
2648   114         1.0000000
2649   114         1.0000000
2650   114         1.0000000
2651   114         1.0000000
2652   124         1.0000000
2653   126         1.0000000
2654   126         1.0000000
2655   124         1.0000000
2656   114         1.0000000
2657   114         1.0000000
2658   114         1.0000000
2659   124         1.0000000
2660   124         1.0000000
2661   114         1.0000000
2662   114         1.0000000
2663   114         1.0000000
2664   114         1.0000000
2665   114         1.0000000
2666   114         1.0000000
2667   114         1.0000000
2668   114         1.0000000
2669    30         1.0000000
2670    30         1.0000000
2671    30         1.0000000
2672    30         1.0000000
2673    30         1.0000000
2674    30         1.0000000
2675    30         1.0000000
2676    20         1.0000000
2677   116         1.0000000
2678   116         1.0000000
2679   114         1.0000000
2680   114         1.0000000
2681   114         1.0000000
2682   114         1.0000000
2683   114         1.0000000
2684   114         1.0000000
2685   114         1.0000000
2686   114         1.0000000
2687   114         1.0000000
2688   114         0.9380544
2689   114         0.9309964
2690   114         1.0000000
2691   114         1.0000000
2692   114         1.0000000
2693   114         1.0000000
2694   114         1.0000000
2695   114         1.0000000
2696   114         1.0000000
2697   114         1.0000000
2698   114         1.0000000
2699   114         1.0000000
2700   114         1.0000000
2701   114         1.0000000
2702   114         1.0000000
2703   114         1.0000000
2704   114         1.0000000
2705   114         1.0000000
2706   114         1.0000000
2707   114         1.0000000
2708   124         1.0000000
2709   124         1.0000000
2710   124         1.0000000
2711   114         1.0000000
2712   124         1.0000000
2713   126         1.0000000
2714   126         1.0000000
2715   126         1.0000000
2716   124         1.0000000
2717   126         1.0000000
2718   126         1.0000000
2719   114         1.0000000
2720   114         1.0000000
2721   114         1.0000000
2722   114         1.0000000
2723   114         1.0000000
2724   114         1.0000000
2725    30         1.0000000
2726    30         1.0000000
2727   126         1.0000000
2728    20         1.0000000
2729    30         1.0000000
2730    30         1.0000000
2731    30         1.0000000
2732    40         1.0000000
2733   114         1.0000000
2734   114         1.0000000
2735   114         1.0000000
2736   114         1.0000000
2737   114         1.0000000
2738   114         1.0000000
2739   114         1.0000000
2740   114         1.0000000
2741   114         1.0000000
2742   114         1.0000000
2743   114         1.0000000
2744   114         0.9380544
2745   114         0.9309964
2746   114         1.0000000
2747   114         1.0000000
2748   114         1.0000000
2749   114         1.0000000
2750   114         1.0000000
2751   114         1.0000000
2752   114         1.0000000
2753   114         1.0000000
2754   114         1.0000000
2755   114         1.0000000
2756   114         1.0000000
2757   114         1.0000000
2758   114         1.0000000
2759   114         1.0000000
2760   114         1.0000000
2761   114         1.0000000
2762   114         1.0000000
2763   114         1.0000000
2764   114         1.0000000
2765   124         1.0000000
2766   124         1.0000000
2767   114         1.0000000
2768   124         1.0000000
2769   126         1.0000000
2770   126         1.0000000
2771   126         1.0000000
2772   124         1.0000000
2773   126         1.0000000
2774   126         1.0000000
2775   114         1.0000000
2776   114         1.0000000
2777   114         1.0000000
2778   114         1.0000000
2779   114         1.0000000
2780   114         1.0000000
2781    30         1.0000000
2782    30         1.0000000
2783   126         1.0000000
2784    40         1.0000000
2785    30         1.0000000
2786    30         1.0000000
2787    20         1.0000000
2788    30         1.0000000
2789   114         1.0000000
2790   114         1.0000000
2791   114         1.0000000
2792   114         1.0000000
2793   114         1.0000000
2794   114         1.0000000
2795   114         1.0000000
2796   114         1.0000000
2797   114         1.0000000
2798   114         1.0000000
2799   114         1.0000000
2800   114         0.9380544
2801   114         0.9309964
2802   114         1.0000000
2803   114         1.0000000
2804   114         1.0000000
2805   114         1.0000000
2806   114         1.0000000
2807   114         1.0000000
2808   114         1.0000000
2809   114         1.0000000
2810   116         1.0000000
2811   116         1.0000000
2812   114         1.0000000
2813   114         1.0000000
2814   114         1.0000000
2815   114         1.0000000
2816   114         1.0000000
2817   114         1.0000000
2818   114         1.0000000
2819   114         1.0000000
2820   114         1.0000000
2821   114         1.0000000
2822   114         1.0000000
2823   114         1.0000000
2824   114         1.0000000
2825   124         1.0000000
2826   124         1.0000000
2827   116         1.0000000
2828   116         1.0000000
2829   116         1.0000000
2830   116         1.0000000
2831   116         1.0000000
2832   114         1.0000000
2833   114         1.0000000
2834   114         1.0000000
2835   114         1.0000000
2836   114         1.0000000
2837    30         1.0000000
2838    30         1.0000000
2839   126         1.0000000
2840    40         1.0000000
2841    30         1.0000000
2842    30         1.0000000
2843    20         1.0000000
2844    30         1.0000000
2845   114         1.0000000
2846   114         1.0000000
2847   116         1.0000000
2848   114         1.0000000
2849   114         1.0000000
2850   114         1.0000000
2851   114         1.0000000
2852   114         1.0000000
2853   114         1.0000000
2854   114         1.0000000
2855   114         1.0000000
2856   114         0.9380544
2857   114         0.9309964
2858   114         1.0000000
2859   114         1.0000000
2860   114         1.0000000
2861   114         1.0000000
2862   114         1.0000000
2863   114         1.0000000
2864   114         1.0000000
2865   114         1.0000000
2866   116         1.0000000
2867   116         1.0000000
2868   114         1.0000000
2869   114         1.0000000
2870   114         1.0000000
2871   114         1.0000000
2872   114         1.0000000
2873   114         1.0000000
2874   114         1.0000000
2875   114         1.0000000
2876   114         1.0000000
2877   114         1.0000000
2878   114         1.0000000
2879   114         1.0000000
2880   114         1.0000000
2881   126         1.0000000
2882   126         1.0000000
2883   126         1.0000000
2884   116         1.0000000
2885   114         1.0000000
2886   114         1.0000000
2887   116         1.0000000
2888   114         1.0000000
2889   114         1.0000000
2890   114         1.0000000
2891   114         1.0000000
2892   114         1.0000000
2893   126         1.0000000
2894    30         1.0000000
2895    20         1.0000000
2896    40         1.0000000
2897    30         1.0000000
2898    30         1.0000000
2899    40         1.0000000
2900   126         1.0000000
2901   116         1.0000000
2902   116         1.0000000
2903   116         1.0000000
2904   114         1.0000000
2905   114         1.0000000
2906   114         1.0000000
2907   114         1.0000000
2908   114         1.0000000
2909   114         1.0000000
2910   114         1.0000000
2911   114         1.0000000
2912   114         0.9380544
2913   114         0.9309964
2914   114         1.0000000
2915   114         1.0000000
2916   114         1.0000000
2917   114         1.0000000
2918   114         1.0000000
2919   114         1.0000000
2920   114         1.0000000
2921   114         1.0000000
2922   114         1.0000000
2923   114         1.0000000
2924   114         1.0000000
2925   114         1.0000000
2926   114         1.0000000
2927   114         1.0000000
2928   114         1.0000000
2929   114         1.0000000
2930   114         1.0000000
2931   114         1.0000000
2932   114         1.0000000
2933   114         1.0000000
2934   114         1.0000000
2935   114         1.0000000
2936   114         1.0000000
2937   126         1.0000000
2938   126         1.0000000
2939   126         1.0000000
2940   114         1.0000000
2941   114         1.0000000
2942   114         1.0000000
2943   116         1.0000000
2944   114         1.0000000
2945   114         1.0000000
2946   114         1.0000000
2947   114         1.0000000
2948   114         1.0000000
2949   126         1.0000000
2950    40         1.0000000
2951    40         1.0000000
2952    30         1.0000000
2953    30         1.0000000
2954    30         1.0000000
2955    40         1.0000000
2956   126         1.0000000
2957   114         1.0000000
2958   114         1.0000000
2959   114         1.0000000
2960   114         1.0000000
2961   114         1.0000000
2962   114         1.0000000
2963   124         1.0000000
2964   114         1.0000000
2965   114         1.0000000
2966   114         1.0000000
2967   114         1.0000000
2968   114         0.9380544
2969   114         0.9309964
2970   114         1.0000000
2971   114         1.0000000
2972   114         1.0000000
2973   114         1.0000000
2974   114         1.0000000
2975   114         1.0000000
2976   114         1.0000000
2977   114         1.0000000
2978   114         1.0000000
2979   124         1.0000000
2980   124         1.0000000
2981   114         1.0000000
2982   114         1.0000000
2983   114         1.0000000
2984   114         1.0000000
2985   114         1.0000000
2986   114         1.0000000
2987   114         1.0000000
2988   114         1.0000000
2989   114         1.0000000
2990   114         1.0000000
2991   114         1.0000000
2992   114         1.0000000
2993   114         1.0000000
2994   114         1.0000000
2995   114         1.0000000
2996   114         1.0000000
2997   114         1.0000000
2998   114         1.0000000
2999   114         1.0000000
3000   114         1.0000000
3001   114         1.0000000
3002   114         1.0000000
3003   124         1.0000000
3004   114         1.0000000
3005   126         1.0000000
3006    40         1.0000000
3007   126         1.0000000
3008    30         1.0000000
3009    30         1.0000000
3010    30         1.0000000
3011    40         1.0000000
3012   126         1.0000000
3013   114         1.0000000
3014   114         1.0000000
3015   114         1.0000000
3016   114         1.0000000
3017   114         1.0000000
3018   114         1.0000000
3019   114         1.0000000
3020   114         1.0000000
3021   114         1.0000000
3022   114         1.0000000
3023   114         1.0000000
3024   114         0.9380544
3025   114         0.9309964
3026   114         1.0000000
3027   114         1.0000000
3028   114         1.0000000
3029   114         1.0000000
3030   114         1.0000000
3031   114         1.0000000
3032   114         1.0000000
3033   114         1.0000000
3034   114         1.0000000
3035   124         1.0000000
3036   126         1.0000000
3037   114         1.0000000
3038   114         1.0000000
3039   114         1.0000000
3040   114         1.0000000
3041   114         1.0000000
3042   114         1.0000000
3043   114         1.0000000
3044   114         1.0000000
3045   114         1.0000000
3046   114         1.0000000
3047   114         1.0000000
3048   114         1.0000000
3049   114         1.0000000
3050   114         1.0000000
3051   114         1.0000000
3052   114         1.0000000
3053   114         1.0000000
3054   114         1.0000000
3055   114         1.0000000
3056   114         1.0000000
3057   114         1.0000000
3058   114         1.0000000
3059   114         1.0000000
3060   114         1.0000000
3061   126         1.0000000
3062   126         1.0000000
3063    40         1.0000000
3064    90         1.0000000
3065    30         1.0000000
3066    30         1.0000000
3067    40         1.0000000
3068    30         1.0000000
3069   124         1.0000000
3070   124         1.0000000
3071   124         1.0000000
3072   114         1.0000000
3073   114         1.0000000
3074   114         1.0000000
3075   114         1.0000000
3076   114         1.0000000
3077   114         1.0000000
3078   114         1.0000000
3079   114         1.0000000
3080   114         0.9380544
3081   114         0.9309964
3082   114         1.0000000
3083   114         1.0000000
3084   114         1.0000000
3085   114         1.0000000
3086   114         1.0000000
3087   114         1.0000000
3088   114         1.0000000
3089   114         1.0000000
3090   114         1.0000000
3091   114         1.0000000
3092   114         1.0000000
3093   114         1.0000000
3094   114         1.0000000
3095   114         1.0000000
3096   114         1.0000000
3097   114         1.0000000
3098   114         1.0000000
3099   114         1.0000000
3100   114         1.0000000
3101   114         1.0000000
3102   114         1.0000000
3103   114         1.0000000
3104   114         1.0000000
3105   114         1.0000000
3106   114         1.0000000
3107   114         1.0000000
3108   114         1.0000000
3109   114         1.0000000
3110   114         1.0000000
3111   114         1.0000000
3112   114         1.0000000
3113   114         1.0000000
3114   114         1.0000000
3115   114         1.0000000
3116   114         1.0000000
3117   114         1.0000000
3118   114         1.0000000
3119   126         1.0000000
3120    40         1.0000000
3121    30         1.0000000
3122    30         1.0000000
3123    40         1.0000000
3124   126         1.0000000
3125   126         1.0000000
3126   126         1.0000000
3127   114         1.0000000
3128   114         1.0000000
3129   114         1.0000000
3130   114         1.0000000
3131   114         1.0000000
3132   114         1.0000000
3133   114         1.0000000
3134   114         1.0000000
3135   114         1.0000000
3136   114         0.9380544
3137   114         0.1318764
3138   114         0.1416508
3139   114         0.1416508
3140   114         0.1416508
3141   114         0.1416508
3142   114         0.1416508
3143   114         0.1416508
3144   114         0.1416508
3145   114         0.1416508
3146   114         0.1416508
3147   114         0.1416508
3148   114         0.1416508
3149   114         0.1416508
3150   114         0.1416508
3151   114         0.1416508
3152   114         0.1416508
3153   114         0.1416508
3154   114         0.1416508
3155   114         0.1416508
3156   114         0.1416508
3157   114         0.1416508
3158   114         0.1416508
3159   114         0.1416508
3160   114         0.1416508
3161   114         0.1416508
3162   114         0.1416508
3163   114         0.1416508
3164   114         0.1416508
3165   114         0.1416508
3166   114         0.1416508
3167   114         0.1416508
3168   114         0.1416508
3169   114         0.1416508
3170   114         0.1416508
3171   114         0.1416508
3172   114         0.1416508
3173   114         0.1416508
3174   114         0.1416508
3175   114         0.1416508
3176   124         0.1416508
3177    90         0.1416508
3178    90         0.1416508
3179    40         0.1416508
3180   126         0.1416508
3181   114         0.1416508
3182   114         0.1416508
3183   114         0.1416508
3184   114         0.1416508
3185   114         0.1416508
3186   114         0.1416508
3187   114         0.1416508
3188   114         0.1416508
3189   114         0.1416508
3190   114         0.1416508
3191   114         0.1416508
3192   114         0.1328761

Extracting the data

  • The first element is ALL of the raster cells that overlap with the first grid cell
    • The total area for the first grid cell is 2.5e+07
    • The total “coverage_fraction” in the first grid cell is 3121
    • How can we find the area of each grid cell?
Code
res(lcnew)
[1] 89.49499 89.49499
  • Area of each grid cell is 89.49499x89.49499 or 8009
  • So total area is 89.49499^2 * sum(extracted[[1]]$coverage_fraction) = 2.5000001^{7}

What do we want to do?

  • We need to go through each element in the list and:
    • Calculate the proportion of the total area that is covered by each class
    • Importantly, we need to make sure we include ALL of the values, even if they are zero (and do not show up in the list)
Code
example <- as_tibble(extracted[[1]])
example <- example |>
  complete(value = unique(lc)$discrete_classification)
summary(example)
     value        coverage_fraction
 Min.   : 20.00   Min.   :0.1319   
 1st Qu.:114.00   1st Qu.:1.0000   
 Median :114.00   Median :1.0000   
 Mean   : 99.36   Mean   :0.9779   
 3rd Qu.:114.00   3rd Qu.:1.0000   
 Max.   :200.00   Max.   :1.0000   
                  NA's   :10       

Aggregate to value

Code
example$coverage_fraction[is.na(example$coverage_fraction)] <- 0
example <- example |>
  group_by(value) |>
  summarize(coverage_fraction = sum(coverage_fraction)) |>
  ungroup() |>
  mutate(coverage_fraction = coverage_fraction/sum(coverage_fraction))
head(example)
# A tibble: 6 × 2
  value coverage_fraction
  <dbl>             <dbl>
1    20          0.0219  
2    30          0.0815  
3    40          0.0962  
4    50          0.00256 
5    60          0       
6    80          0.000320

Reshape wide

Code
# long to wide
example <- example |>
  pivot_wider(names_from = value, values_from = coverage_fraction,
    names_prefix = "coveragefraction")
example
# A tibble: 1 × 20
  coveragefraction20 coveragefraction30 coveragefraction40 coveragefraction50
               <dbl>              <dbl>              <dbl>              <dbl>
1             0.0219             0.0815             0.0962            0.00256
# ℹ 16 more variables: coveragefraction60 <dbl>, coveragefraction80 <dbl>,
#   coveragefraction90 <dbl>, coveragefraction111 <dbl>,
#   coveragefraction112 <dbl>, coveragefraction113 <dbl>,
#   coveragefraction114 <dbl>, coveragefraction115 <dbl>,
#   coveragefraction116 <dbl>, coveragefraction121 <dbl>,
#   coveragefraction122 <dbl>, coveragefraction123 <dbl>,
#   coveragefraction124 <dbl>, coveragefraction125 <dbl>, …

We need to do that for the ENTIRE list!

Code
wrapper <- function(x){
  x <- as_tibble(x)
  x <- x |>
    complete(value = unique(lc)$discrete_classification)
  x$coverage_fraction[is.na(x$coverage_fraction)] <- 0
  x <- x |>
    group_by(value) |>
    summarize(coverage_fraction = sum(coverage_fraction)) |>
    ungroup() |>
    mutate(coverage_fraction = coverage_fraction/sum(coverage_fraction)) |>
    pivot_wider(names_from = value, values_from = coverage_fraction,
      names_prefix = "coveragefraction")
}
# Takes a LONG time! so I've uploaded it for you
extracted <- lapply(extracted, wrapper)
extracted <- bind_rows(extracted)

Now we can add those values to kgrid

Code
extracted <- read_csv("week7files/extracted.csv")
kgrid <- vect("week7files/kgrid.shp")
kgrid <- cbind(kgrid, extracted)
names(kgrid)
 [1] "id"                  "coveragefraction20"  "coveragefraction30" 
 [4] "coveragefraction40"  "coveragefraction50"  "coveragefraction60" 
 [7] "coveragefraction80"  "coveragefraction90"  "coveragefraction111"
[10] "coveragefraction112" "coveragefraction113" "coveragefraction114"
[13] "coveragefraction115" "coveragefraction116" "coveragefraction121"
[16] "coveragefraction122" "coveragefraction123" "coveragefraction124"
[19] "coveragefraction125" "coveragefraction126" "coveragefraction200"

Now we can add those values to kgrid