[ncl-talk] output values are wrong

E Mobarak mobarak_e at yahoo.com
Tue Jan 22 23:31:56 MST 2019


Hi 
I try to read multiple wrfchem output files and  extract surface temperature for multiple stations, and output  all the files write in  one csv file for comparing , but the values are wrong and it seems like a if condition.please help me where is wrongthis is my scriptBest RegardsElham 
 year = "2012"
  month = "03"
  day = "16"
  hour = "00"
  Dirin = "./"+ year + month + "/20190114/"

    wrffiles = systemfunc("ls  " + Dirin +  "*wrf*" )
    print (wrffiles)
    numFiles = dimsizes(wrffiles)
    do i = 0, numFiles -1
    wrffiles(i) = wrffiles(i)+".nc"
    nd = dimsizes(wrffiles)
    end do
   inpFiles = addfiles(wrffiles,"r")

   do ifile = 0, numFiles-1
   a = inpFiles[ifile]

;  a = addfile(Dirin+"YSU_wrfout_d01_2012-03-16_00:00:00.nc","r")


 opt = True
  ip_lon = (/ 48.73,47.27,46.17/)
  ip_lat = (/ 31.33,32.67,33.10/)
 nlocs = dimsizes(ip_locs)
     do ip = 0 , nlocs-1
     opt = True
     loc  = wrf_user_ll_to_ij(a,ip_lon(ip),ip_lat(ip),opt)
     loc = loc-1

     t    = wrf_user_getvar(a,"T2",-1)    ; get t2 for all times
    ttf  = t(:,loc(1),loc(0))               ; extract a time series at a point
    tf = ttf-273.16

if (ifile.eq.0) then
t_acm = tf

else if (ifile.eq.1) then
t_bo = tf

else if (ifile.eq.2) then
t_mjj = tf

else if (ifile.eq.3) then
t_sh = tf

else if (ifile.eq.4) then
t_uw = tf

else if (ifile.eq.5) then
t_ysu = tf

slist = [/"date,"+"year, " + "month," + "day," + "hour,"+"t_AC,"+ "t_BO,"+"t_MJJ,"+"t_SH,"+"t_UW,"+"t_YSU,"    /]
 write_table( Diro+ip_locs(ip)+"tem.csv","a" ,slist,"  %s,")
 alist=[/ yymmddhh,year1, mm, dd, hh, t_acm,t_bo,t_mjj,t_sh,t_uw,t_ysu/]
 write_table( Diro+ip_locs(ip)+"tem.csv","a" ,alist," %s, %s, %s, %s, %s, %8.2f, %8.2f, %8.2f, %8.2f, %8.2f, %8.2f, %8.2f, %8.2f,")

end if
end if
end if
end if
end if
end if

end do
end do
end




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190123/1ef9df70/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex-multista.ncl
Type: application/octet-stream
Size: 2621 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190123/1ef9df70/attachment.obj>


More information about the ncl-talk mailing list