0

我有全球地理数据表,它有 5 列:Lon、Lat、Year、Day、X。我想对其进行栅格化并将其保存为 tif 文件。我的最终目标是将“X”作为 lon、lat、days 的函数保存在 tif 文件中:X[Lon, Lat, Days]。我写了以下代码:

list_year=np.arange(2010,2015)
for i in list_year:
    df_fyr = pandas_df[pandas_df['Year']==i] # filter year
    geometry = [Point(xy) for xy in zip(df_fyr.Lon, df_fyr.Lat)] #create geometry 
    x_fyr_gdf = GeoDataFrame(df_fyr, crs="EPSG:4326", geometry=geometry) #create geodataframe
    rasterized_x_fyr = make_geocube(vector_data=x_fyr_gdf, measurements = ['Day','X'], resolution=(-0.5,0.5)) # rasterize_points_griddata
    rasterized_x_fyr.rio.to_raster("rasterized_x_daily_"+str(i)+".tif")

但输出是 X[720,360,1] 而不是 X[720,360,365]。任何帮助表示赞赏。谢谢

4

0 回答 0