从多维NETCDF创建[时间,LON,LAT]维度
我有来自Jason具有不寻常维度的卫星高度学数据(点,未握住):时间和suse_index。我想拥有一个[时间,LON,LAT]维度,而不会影响数据集。目前,LAT和LON是坐标,我尝试了 this ,但是我们有不同的数据集。
import xarray as xr
import pandas as pd
all_lat = xr.open_dataset('dataset.nc')
xarray.Dataset
Dimensions: time: 3031 meas_ind: 20
Coordinates:
**time** (time) datetime64[ns] 2002-01-23T02:26:13.761423824 .....
**meas_ind** (meas_ind) int8 0 1 2 3 4 5 6 ... 14 15 16 17 18 19
lat (time) float64 ...
lon (time) float64 ...
lon_20hz (time, meas_ind) float64 ...
lat_20hz (time, meas_ind) float64 ...
Data variables: (141)
Attributes: (25)
此外,我只需要SSHA变量,该变量在LAT和LON是坐标时会索引到时间。
xarray.DataArray'ssha' time: 3031
array([ 0.011, -0.019, 0.026, ..., nan, nan, nan], dtype=float32)
Coordinates:
time (time) datetime64[ns] 2002-01-23T02:26:13.761423824 .....
lat (time) float64 -66.15 -66.15 ... 66.15 66.15
lon (time) float64 34.11 34.24 34.37 ... 199.0 199.2
我在这里上传了数据集:
I have this satellite altimetry data (points, not gridded) from Jason that has unusual dimensions: time and meas_index. I would like to have a [time, lon, lat] dimension without affecting the dataset. Currently, the lat and lon are coordinates and I have tried this but we have different datasets.
import xarray as xr
import pandas as pd
all_lat = xr.open_dataset('dataset.nc')
xarray.Dataset
Dimensions: time: 3031 meas_ind: 20
Coordinates:
**time** (time) datetime64[ns] 2002-01-23T02:26:13.761423824 .....
**meas_ind** (meas_ind) int8 0 1 2 3 4 5 6 ... 14 15 16 17 18 19
lat (time) float64 ...
lon (time) float64 ...
lon_20hz (time, meas_ind) float64 ...
lat_20hz (time, meas_ind) float64 ...
Data variables: (141)
Attributes: (25)
In addition, I only need the ssha variable, which is indexed to time while the lat and lon are coordinates.
xarray.DataArray'ssha' time: 3031
array([ 0.011, -0.019, 0.026, ..., nan, nan, nan], dtype=float32)
Coordinates:
time (time) datetime64[ns] 2002-01-23T02:26:13.761423824 .....
lat (time) float64 -66.15 -66.15 ... 66.15 66.15
lon (time) float64 34.11 34.24 34.37 ... 199.0 199.2
I uploaded the dataset here: link
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论