[英]How to find climatological monthly mean from a netcdf data set using python?
我有一個 netcdf 數據集(每月時間x緯度x經度)。 月數是 216,所以總共 18 年。 第一個索引代表 1 月數據,第 2 個索引代表 2 月數據……第 12 個索引代表 12 月數據,第 13 個索引代表 1 月數據,第 14 個索引代表 2 月數據,依此類推。 現在我想找到所有 1 月數據的平均值,所有 2 月數據的平均值......所有 12 月數據的平均值。 因此,在執行此操作后,數組的大小將減少到 12xlatxlon(以前是 216xlatxlon)。 我怎樣才能做到這一點?
如果您正在使用 linux 或 macOS,您可以使用我的 nctoolkit package ( Z5E056C500A1C4B6A7110B50D807BADE .
import nctoolkit as nc
ds = nc.open_data("infile.nc")
# get the mean using month as the averaging period
ds.tmean("month")
# plot to visualize
ds.plot()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.