2017-09-13 23 views
0

我是新人,在陡峭的曲線上學習IDL。我有2 PROS第一個如下IDL編程語言中的調用例程

Pro READ_Netcdf1,infile,temperature,time,print_prompts=print_prompts 

COMPILE_OPt IDL2 

infile='D:/Rwork/dataset/monthly_mean/version_2C/air.2m.mon.mean.nc' 


IF (N_Elements(infile) EQ 0) Then STOP,'You are being silly, you must specify infile on call' 



print,infile 
iid = NCDF_OPEN(infile) 
NCDF_VARGET, iid, 'time', time    ; Read time 
NCDF_VARGET, iid, 'air', temperature  ; Read surface average temperature 
NCDF_VARGET, iid, 'lat', latitude   ; Read Latitude 
NCDF_VARGET, iid, 'lon', longitude   ; Read Longitude 
NCDF_CLOSE, iid        ; Close Input File 

Centigrade=temperature-273.15 

    print,'Time' 
    print,time[0:9] 
    Print, 'Latitude' 
    Print, latitude[0:9] 
    Print, 'Longitude' 
    Print, longitude[0:9] 
    print,'Temperature' 
    print, temperature[0:9] 
    Print, 'Centigrade' 
    Print, Centigrade[0:9] 

;ENDIF 

RETURN 
END 

這完美的作品。我的第二個專業如下: -

PRO Change_Kelvin_to_Cent,Temperature 

;+ This programme take the temperature from the NETCDF file and converts 
; to Centigrade 
;Output 
; The Month Mean Temperature in Centigrade 
; Must have read ncdf1 in the directory run first 
; 
; - 
COMPILE_OPt IDL2 

infile='D:/Rwork/dataset/monthly_mean/version_2c/air.2m.mon.mean.nc' 

read_netcdf1, infile, Temperature     



Centigrade = Temperature-273.15 

print,'Centigrade' 
print,Centigrade[0:9] 

RETURN 
END 

這也適用 我被指示致電從第一PRO變量「溫度」來計算第二PRO 溫度不命令行

read_netcdf1,infile,溫度

我不能得到這個工作。任何人都可以建議並幫助我解決這個問題請

回答

0

我誤會了。它不能完成。您必須擁有 「read_netcdf1,infile,溫度」一段代碼。雖然溫度可以是任何標籤,因爲它的位置不在措辭中。 我希望這使得sence