I am new and learning IDL on a steep curve. I have 2 PROS first one follows
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
This works perfectly. My second Pro is as follows:-
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
This also works I am being instructed to call the variable "Temperature" from the first PRO to calculate the Temperature in the second PRO without the command line
read_netcdf1, infile, Temperature
I cannot get this to work. Can anybody advise and help me out of this problem please
I was misinformed . it can not be done. You must have the "read_netcdf1, infile, Temperature" piece of code. Although Temperature can be any tag because it the position it is in not the wording. i hope this makes sence