0

Circumpolar Arctic Vegetation マップを使用しています。terra を含む SpatRaster として格納されたラスターには、21 の土地被覆クラスがあります。

> str(lc_2003)
Formal class 'SpatRaster' [package "terra"] with 1 slot
  ..@ ptr:Reference class 'Rcpp_SpatRaster' [package "terra"] with 17 fields
  .. ..$ depth    : num 0
  .. ..$ extent   :Reference class 'Rcpp_SpatExtent' [package "terra"] with 2 fields
  .. .. ..$ valid : logi TRUE
  .. .. ..$ vector: num [1:4] 3946387 7965081 2200504 5681579
  .. .. ..and 27 methods, of which 13 are  possibly relevant:
  .. .. ..  align, as.points, ceil, compare, finalize, floor, initialize, intersect, round, sample,
  .. .. ..  sampleRandom, sampleRegular, union
  .. ..$ filenames: chr ""
  .. ..$ hasRange : logi TRUE
  .. ..$ hasTime  : logi FALSE
  .. ..$ hasValues: logi TRUE
  .. ..$ inMemory : logi TRUE
  .. ..$ messages :Reference class 'Rcpp_SpatMessages' [package "terra"] with 2 fields
  .. .. ..$ has_error  : logi FALSE
  .. .. ..$ has_warning: logi FALSE
  .. .. ..and 18 methods, of which 4 are  possibly relevant:
  .. .. ..  finalize, getError, getWarnings, initialize
  .. ..$ names    : chr "PHYSIOG"
  .. ..$ origin   : num [1:2] 102.7 91.3
  .. ..$ range_max: num 21
  .. ..$ range_min: num 1
  .. ..$ res      : num [1:2] 5172 3881
  .. ..$ rgb      : logi FALSE
  .. ..$ time     : num 0
  .. ..$ timestep : chr "seconds"
  .. ..$ units    : chr ""

ただし、レイヤーPHYSIOGの各値を実際の土地被覆クラス名に関連付けたいと思います。これは、ArcGis でファイルを表示したり、特定の調査プロットがどの生息地タイプに該当するかを評価したりするのに役立ちます。

landcover_classes <- data.frame(lc_code = 1:21,
                                lc_class = c(
                                  "Cryptogam, herb barren",
                                  "Rush/grass, forb, cryptogam tundra",
                                  "Cryptogam barren complex (bedrock)",
                                  "Prostrate dwarf-shrub, herb tundra",
                                  "Graminoid, prostrate dwarf-shrub, forb tundra",
                                  "Prostrate/Hemiprostrate dwarf-shrub tundra",
                                  "Nontussock sedge, dwarf-shrub, moss tundra",
                                  "Tussock-sedge, dwarf-shrub, moss tundra",
                                  "Erect dwarf-shrub tundra",
                                  "Low-shrub tundra",
                                  "Missing (Cryprogram dwarf-shrub?)",
                                  "Sedge/grass, moss wetland",
                                  "Sedge, moss, dwarf-shrub wetland",
                                  "Sedge, moss, low-shrub wetland",
                                  "Noncarbonate mountain complex",
                                  "Carbonate mountain complex",
                                  "Nunatak complex",
                                  "Glaciers",
                                  "Water",
                                  "Lagoon",
                                  "Non-Arctic areas"))

このデータを SpatRaster に追加するにはどうすればよいですか?

(SpatRasterの再現可能な例を作成する方法がわかりません。これについては別の質問で尋ねます)

4

1 に答える 1

1

あなたはできるはずです

levels(lc_2003) <- landcover_classes

そして、結果を見てください

plot(lc_2003)

の例を参照してください?terra::levels

于 2021-06-24T21:03:01.487 に答える