#define c_str(s) ('s\0') c------------------------------------------------------------ subroutine nao_init c------------------------------------------------------------ include 'comm_para.h' include 'comm_new.h' include 'comm_data.h' include 'comm_nao.h' real inp_flt, inp_days logical inp_def dimension flt(100) use_nao = .false. inao = inp_int(c_str(NAO_type),0) if (inao .gt. 0) then use_nao = .true. endif tnao = 12.* inp_days (c_str(NAO_time), 365.)/ 365. ! time in months n_tnao = inp_str(c_str(Wind_anom_file), c_str(wind_anom_data), fbtau_a) n_wspa = inp_str(c_str(Wndspd_anom_file),c_str(wndspd_anom_data), fwspa) n_uwda = inp_str(c_str(Uwnd_anom_file),c_str(uwnd_anom_data), fuwda) n_vwda = inp_str(c_str(Vwnd_anom_file),c_str(vwnd_anom_data), fvwda) n_aha = inp_str(c_str(Airhum_anom_file),c_str(ahum_anom_data), faha) n_ata = inp_str(c_str(Airtem_anom_file),c_str(atem_anom_data), fata) n_prpa = inp_str(c_str(Precip_anom_file),c_str(prp_anom_data), fprpa) freq_nao = 2.*3.1415926/tnao if (inao.eq.2) then nnao = inp_str(c_str(NAO_index_file), c_str(nao_data), fbnao) open (unit = INAO_OUT, file = fbnao(1:nnao)) n = 0 do i= 1, max_nao read(INAO_OUT,*,END=110) t_nao(n+1),v_nao(n+1) c print*,n+1,t_nao(n+1),v_nao(n+1) n = n + 1 enddo 110 continue n_nao = n i_nao = 1 tscl_anom = v_nao(1) close (INAO_OUT) endif inao_key = inp_int(c_str(NAO_err), 0) if (inao_key .ne. 0) * n_naok = inp_str(c_str(NAO_errfile), * finp(1:mlen(finp))//'.nao\0', f_naok) if (inao_key.gt.0) then if (irest .eq. 1. .or. irest .eq. 2) then open (unit = INAO_OUT, file = f_naok(1:n_naok), access='APPEND') else open (unit = INAO_OUT, file = f_naok(1:n_naok)) endif endif return end c------------------------------------------------------------ subroutine set_tanom(tenso) c------------------------------------------------------------ include 'comm_nao.h' if (inao.eq.2) then if (tenso.gt.t_nao(1).and.tenso.lt.t_nao(n_nao)) then do i = 1, n_nao if (tenso.lt.t_nao(i_nao)) goto 10 i_nao = i_nao+ 1 enddo 10 continue i_naom = i_nao- 1 tscl= (tenso- t_nao(i_naom))/(t_nao(i_nao)- t_nao(i_naom)) tscl_anom = (1- tscl)*v_nao(i_naom) + tscl*v_nao(i_nao) endif elseif (inao.eq.1) then tscl_anom = cos ( freq_nao*(tenso-1.5) ) endif return end