2017-05-14 2 views
0

해양학 및 기상학을 위해 개발 한 파이썬 아이리스 모듈을 사용하여 경도를 따라 단면을 그리기 원합니다. 예 : http://scitools.org.uk/iris/docs/v1.4/examples/graphics/cross_section.html 예제를 사용하여 코드를 변경하려고했지만 출력했습니다. 내 코드가 비어 있습니다.파이썬 아이리스 모듈을 사용하여 단면도

데이터 : http://data.nodc.noaa.gov/thredds/fileServer/woa/WOA09/NetCDFdata/temperature_annual_1deg.nc

import iris 
import iris.plot as iplt 
import iris.quickplot as qplt 

# Enable a future option, to ensure that the netcdf load works the same way 
# as in future Iris versions. 
iris.FUTURE.netcdf_promote = True 

# Load some test data. 
fname = 'temperature_annual_1deg.nc' 

theta = iris.load_cube(fname, 'sea_water_temperature') 
# Extract a single depth vs longitude cross-section. N.B. This could 
# easily be changed to extract a specific slice, or even to loop over *all* 
# cross section slices. 
cross_section = next(theta.slices(['longitude', 
            'depth'])) 

qplt.contourf(cross_section, coords=['longitude', 'depth'], 
       cmap='RdBu_r') 
iplt.show() 
+0

을 나는 바다 태그가 여기에 올 생각하지 않는다; 그것은 기름 & 가스 발달 플래트 홈에 관하여,보십시오 http://stackoverflow.com/questions/tagged/ocean – ThomasG

+0

당신 맞은, 나는 일반적인 꼬리표이라고 생각했다 –

답변

0

당신이 여기 이해하는 데 필요한 것은 당신의 cross_section 전류가 현재의 경우 비어있는 좌표 (의 한쪽 끝에서 시작한다는 것을 의미 theta.slices 반복자의 첫 번째 구성원으로 정의된다). 따라서 데이터를 얻을 때까지 반복자의 다음 멤버를 반복해야합니다.

import numpy as np 
cs = theta.slices(['longitude', 'depth']) 
for i in cs: 
    print(np.nanmax(i)) 

같은 인쇄해야하는 : 당신이 코드에 다음 줄을 추가 할 경우, 아마도 무슨 일이 일어나고 있는지 이해하는 데 도움

-- 
-- 
-- 
-0.8788 
-0.9052 
관련 문제