目前我处理一堆坐标(epsg: 4326 = >纬度/经度)及其对应的值(温度)。我们的目标是将这些坐标和它们的值写入一个简单的netcdf文件和显示在如QGIS(这样你将有一个为每个像素颜色的正方形/协调)目前在分散数据格式,这就是为什么第一次插值。插值后我试图写入数据(光栅格式)到一个netcdf文件,但这失败:进口numpy从scipy.interpolate np进口griddata进口xarray xr进口熊猫一样pd进口rioxarray进口netCDF4 nc4 lat =(50.1, 50.2, 50.3, 50.4, 50.5, 62]朗= (8.1,8.2,8.3,8.4,8.5,12]temp =[1、2、3、4、5、6] #准备一个网格插值ξ= np.arange(6.0, 14.0, 0.001)易= np.arange(48.0, 64.0, 0.001),易= np。meshgrid (xi, yi) #你可以看到稍大,那么使用网格坐标#插入子= griddata((经度、纬度)、温度(xi, yi)方法=“线性”)#时间写这到netcdf文件ds = nc4.Dataset(“测试。数控”、“w”,格式= ' NETCDF3_CLASSIC”) dim_time = ds。createDimension('时间',0)dim_lat = ds。createDimension (lat, len (yi)) dim_lon = ds。createDimension(经度,len (xi)) #这是正确的还是我该如何设置CRS epsg: 4326 ?crs = ds。createVariable crs (“WGS84”、“c”)。spatial_ref = " "“GEOGCS (“WGS 84”,基准面(“WGS_1984球体(“WGS 84”, 6378137, 298.257223563,权威[“EPSG”、“7030”]],权威[“EPSG”、“6326”]], PRIMEM[“格林威治”,0,权威[“EPSG”、“8901”]],单位(“学位”,0.01745329251994328,权威[“EPSG”、“9122”]],权威[“EPSG”、“4326”]]””“时间= ds。createVariable(“时间”、“f4”,“时间”)纬度= ds。createVariable(“纬度”、“f4”、“纬度”)纬度。单位=‘度’经度= ds。createVariable(“朗”、“f4”、“朗”)经度。单位=‘度’价值= ds。createVariable(“温度”、“f4”,(“时间”、“纬度”、“朗”,))#充满价值观纬度[:]= lat # = >错误:ValueError:形状不匹配:对象不能播放一个形状经度[:]=经度值(0::)=子值。grid_mapping = 'WGS84' ds.close() When i try to write to e.g. latitude variable it throws: ValueError: shape mismatch: objects cannot be broadcast to a single shape I debugged throw the code but wasnt able to find the error, any experts around? Cheers!