我有两个结构相同的类似Netcdf文件,例如:
file1 = xr.open_dataset("file1.nc")
file2 = xr.open_dataset("file2.nc")
print(file1)
Dimensions: (Number_of_points: 232678)
Dimensions without coordinates: Number_of_points
Data variables:
XLON (Number_of_points) float64 ...
XLAT (Number_of_points) float64 ...
VERSION int32 ...
BUG int32 ...
STORAGETYPE |S40 ...
SPLIT_PATCH |S1 ...
SEA |S40 ...
WATER |S40 ...
NATURE |S40 ...
...
print(file2)
Dimensions: (Number_of_points: 232678)
Dimensions without coordinates: Number_of_points
Data variables:
XLON (Number_of_points) float64 ...
XLAT (Number_of_points) float64 ...
VERSION int32 ...
BUG int32 ...
STORAGETYPE |S40 ...
SPLIT_PATCH |S1 ...
NATURE |S40 ...
...
在其中一个文件中,我缺少一些变量(例如,上面的变量SEA和WATER) 我想比较两个文件以获得两个数据集之间的匹配变量名称,然后遍历file1以仅加载缺少的维度。 我想要的最终结果是自动加载:
Var1 = file1.SEA
Var2 = file1.WATER
是否有使用Xarray做到这一点的简单方法?
谢谢
Théo
答案 0 :(得分:0)
(从我的评论中复制,似乎很成功)
您可以在此处使用常规python:
var body: some View {
ZStack {
if Auth.auth().currentUser = nil
// Your LogIn-View
} else {
LandingPageView()
}
}