问题描述
我使用光栅包读取 NetCDF 文件并想在 R 中处理它。一些操作为我提供了具有 1461 个层的 RasterBrick 对象 r_daily
,对应于 4 年中的每日值:
> r_daily
class : RasterBrick
dimensions : 360,720,259200,1461 (nrow,ncol,ncell,nlayers)
resolution : 0.5,0.5 (x,y)
extent : -180,180,-90,90 (xmin,xmax,ymin,ymax)
crs : +proj=longlat +datum=wgs84 +no_defs
> names(r_daily)
[1] "y2011.01.01" "y2011.01.02" "y2011.01.03" "y2011.01.04"
[5] "y2011.01.05" "y2011.01.06" "y2011.01.07" ...
现在我只想对每年的所有值求和以获得 RasterBrick 对象 r_yearly
。
> r_yearly
class : RasterBrick
dimensions : 360,4 (nrow,ymax)
crs : +proj=longlat +datum=wgs84 +no_defs
我很感激任何帮助或提示!
解决方法
我现在在 this post 中找到了一个我以前没有遇到过的很好的解决方案。
spark.driver.memory 35g
spark.executor.instances 24
spark.executor.memory 35g
spark.executor.cores 5
spark.dynamicAllocation.enabled false
spark.network.timeout 600
#spark.dynamicAllocation.enabled true
#spark.dynamicAllocation.shuffleTracking.enabled true
#spark.shuffle.service.enabled true
spark.cores.max 60
spark.io.compression.codec org.apache.spark.io.LZ4CompressionCodec
spark.sql.parquet.compression.codec uncompressed