其他分享
首页 > 其他分享> > delft3d 瞎搞

delft3d 瞎搞

作者:互联网

def add_dep(dataset):
if 'LAYER_INTERFACE' in dataset:
print("LAYER_INTERFACE property alread in DataSet, renaming it to depth...")
else:
print("Calculating depth of interfaces...")
depth = dataset.S1
depth.values = dataset.DP0.values[:] + dataset.S1.values[:]
# depth_center =depth_center.assign_attrs({"unit": "m", "long_name": "Depth at Sigma-layer centers"})
depth = depth.assign_attrs({"unit": "m", "long_name": "Depth at zeta"})
dataset['dep'] = depth
return dataset



def makevel(dataset, transpose=True):
vel = dataset.U1
angel = dataset.V1
u = dataset.U1.values
v = dataset.V1.values
vel.values = np.sqrt(u**2+v**2)
angel.values = np.degrees(np.arctan(u/v))
vel = vel.assign_attrs({"unit": "m/s", "long_name": "Depth at zeta"})
angel = angel.assign_attrs({"unit": "°", "long_name": "Depth at zeta"})
dataset['vel'] = vel
dataset['angel'] = angel
return dataset

标签:angel,dataset,depth,values,attrs,瞎搞,vel,delft3d
来源: https://www.cnblogs.com/chenyun-delft3d/p/14736567.html