[英]Expand a time series in the form of numpy.array(), pandas.DataFrame(), or xarray.DataSet() to contain the missing records as NaN
[英]How to convert numpy.array to xarray.dataset in python?
我有一个卫星文件,其中包含 (0,360) 范围内的经度,而我想将其转换为 (-180,180)。为了做到这一点,我在这里找到了一种使用 xarray.where HERE的方法,但是这个 xr.where( ) 仅适用于“xarray 数据集”而不适用于“numpy.array”。 (绘制后卫星轨道轨迹有一些间隙)。 因此,如果您能告诉我如何将 numpy 数组转换为 xarray.dataset,我将不胜感激?
#Reading the basic file type(orbit['lon']) >> numpyarray type(orbit['lat']) >> numpyarray etc.
这里第一部分将经度 (180, 360) 更改为负数,并按升序对经度进行排序。
ds = ds.assign_coords(lon=(((ds.lon + 180) % 360) - 180)).sortby("lon")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.