代码之家  ›  专栏  ›  技术社区  ›  CptNemo

什么会导致聚合多边形和光栅数据时丢失值?

  •  0
  • CptNemo  · 技术社区  · 4 年前

    聚合(使用 sf::aggregate()

    enter image description here

    require(sf)
    require(stars)
    
    # Download here => http://www.filedropper.com/adaptorcamsregionalfcretrieve-15879390618606012-22402-6-64f0e215-609d-4ca6-b65c-a9ef7dc53370
    raster_file <- 
      "adaptor.cams_regional_fc.retrieve-1587939061.8606012-22402-6-64f0e215-609d-4ca6-b65c-a9ef7dc53370.nc"
    
    # Download here => https://drive.google.com/file/d/1fEhy3V4h1h5efDMrfa0x_mvnx2VL5T66/view?usp=sharing
    polygon_file <-
      "hex_ita_1km.sf.RData"
    r <- 
      read_stars(raster_file)
    load(polygon_file)
    
    st_crs(r) <- 4326
    st_crs(hex_ita_1km.sf) <- st_crs(32632)
    
    

    r 两个变量中都不包含任何缺少的数据

    summary(r$pm10_conc)
    summary(r$pm2p5_conc)
    
     Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
    

    0.08376 4.79556 9.77700 14.13988 18.06134 196.88487

    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
    

    0.05215 2.08035 4.39209 5.51724 7.46488 54.89545

    a <- 
      aggregate(st_transform(r, 32632), 
                by = hex_ita_1km.sf, 
                FUN = mean)
    
    plot(a, border = NA)
    
    0 回复  |  直到 4 年前