如何从NETCDF文件中创建横截面海洋档案?
我想沿着海岸线的横断面创建一个3D(长,深度,氧)的横截面。例如,类似于使用Metpy软件包,但是我似乎无法使XY数据工作,并且我正在使用海洋数据而不是大气数据。
我已经尝试了以下(理论上使用Metpy软件包,我需要使用Metpy软件包):
df="F:/L3_prog_ControlRun201808_ocean_avg.nc" #my dataset
ds=xr.open_dataset(df,engine='netcdf4')
ds['lon_rho']=ds['lon_rho']-360 #to make the longitude in degrees East
data = ds['oxygen'].metpy.assign_crs({
"grid_mapping_name": "mercator",
"latitude_of_projection_origin":43,
"longitude_of_central_meridian":-66,
"standard_parallel":0,
"false_easting":360
}).metpy.assign_y_x()
#this does not create x,y coordinates for some reason
#If the above had worked, I would like to create a cross-section on the transect between:
start=(43.5, -65)
end=(44.5,-63.8)
#using:
cross = cross_section(data, start, end).set_coords(('lat_rho', 'lon_rho'))
print(cross)
I would like to create a cross-section of 3D (long, depth, oxygen) along a transect that follows a coastline. E.g. similar to using the MetPy package, however I cannot seem to get the x-y data to work, and I am working with ocean data rather than atmospheric data.
I have tried the following (using the MetPy package as it theoretically does what I need):
df="F:/L3_prog_ControlRun201808_ocean_avg.nc" #my dataset
ds=xr.open_dataset(df,engine='netcdf4')
ds['lon_rho']=ds['lon_rho']-360 #to make the longitude in degrees East
data = ds['oxygen'].metpy.assign_crs({
"grid_mapping_name": "mercator",
"latitude_of_projection_origin":43,
"longitude_of_central_meridian":-66,
"standard_parallel":0,
"false_easting":360
}).metpy.assign_y_x()
#this does not create x,y coordinates for some reason
#If the above had worked, I would like to create a cross-section on the transect between:
start=(43.5, -65)
end=(44.5,-63.8)
#using:
cross = cross_section(data, start, end).set_coords(('lat_rho', 'lon_rho'))
print(cross)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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