<div dir="ltr">I hope that you help me, because it's important for my research.<div><br></div><div>Jesus</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-26 22:51 GMT-05:00 Jesús Garcia Rosales <span dir="ltr"><<a href="mailto:jesus21gr@gmail.com" target="_blank">jesus21gr@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi users I have a problem. This is my script:<br><br><br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"<br>;*****************************************************<br>begin<br><br>inidx = 0<br>inloc = "Huayao"<br>inlat = -12.04<br>inlon = -75.32<br><br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>; Now open station data (observations) and read in<br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br><br><br> delim = "," ; these are csv files<br><br> ; El Nino<br> ; open the files and read in the data<br> obs_data_pd_elnino = asciiread("/media/jesus/TOSHIBA/ncl_alan/datos/estacion_diaria.csv",-1,"string")<br> obs_strs_pd_elnino = str_split_csv (obs_data_pd_elnino, ",", 0)<br> obs_pointdata_pd_elnino=tofloat(obs_strs_pd_elnino(1:27,2::))<br><br> ; Now compute the length(0) and width(1) of the data matrix<br> obsdims_pd_elnino = dimsizes(obs_pointdata_pd_elnino)<br><br> ; Find the data column that corresponds to your station of interest<br> obs_pointdata_1stn_pd_elnino = obs_pointdata_pd_elnino(:,inidx)<br><br> ; now compute a daily climatology from the time series (i.e., average all days together)<br> obs_pointdata_1stn_90d_multiyear_pd_elnino = onedtond(obs_pointdata_1stn_pd_elnino,(/(obsdims_pd_elnino(0)/3),3/))<br> obs_pointdata_1stn_dayclm_pd_elnino = dim_avg_n(obs_pointdata_1stn_90d_multiyear_pd_elnino,1)<br><br> <br><br><br><br><br>fname = ("/media/jesus/TOSHIBA/WRF_alan/9km/wrfout_d01_2003-01-29_00:00:00") ; input precip data <br> fin = addfile (fname,"r") <br> ; prc = fin->pr ; (time,yc, xc) 3 hrly <br> lat = fin->XLAT <br> lon = fin->XLONG<br><br> time = fin->Times <br> ntimes = dimsizes(time)<br><br><br> rain_exp = wrf_user_getvar(fin,"RAINNC",-1)<br> rain_con = wrf_user_getvar(fin,"RAINC",-1)<br><br>;rain_exp=fin->RAINNC(:,:,:)<br>;rain_con=fin->RAINC(:,:,:)<br><br> rain_tot = rain_exp + rain_con<br><br> rain=rain_tot(0:743,:,:)<br><br> do it=1,743,1 <br><br> rain(it,:,:)=rain_tot(it,:,:)-rain_tot(it-1,:,:)<br><br> end do<br> <br> ;x(time,lev,lat,lon) <br><br> dimx = dimsizes(rain) <br> ntim = dimx(0) ; number of time steps <br> ; printVarSummary(rain) <br><br> ;nlat = dimx(2) <br> ; mlon = dimx(3) <br><br> nday = ntim/24 <br><br><br> ; print("nday="+nday) <br> ; print("ntim="+ntim)<br><br> xday = rain(::24,:,:) ; 'trick' to allocate memory + retain meta data <br> ; printVarSummary(xday)<br> <br> do nt=0,ntim-1,24 <br> xday(nt/24,:,:) = dim_avg_n_Wrap(rain(nt:nt+23,:,:),0) ;<br><br> end do <br><br><br>modvar_pd_elnino = xday(3:29,:,:)<br><br>modvar_pd_elnino!0="time"<br>modvar_pd_elnino!1="lat"<br>modvar_pd_elnino!2="lon"<br><br><span style="color:rgb(255,0,0)"><span style="color:rgb(0,0,0)">; Find latitudes and longitudes so that you can interpolate data to specified station<br> lat = modvar_pd_elnino&lat<br> lon = modvar_pd_elnino&lon </span><br></span><br><br>; El Nino<br> mod_pointdata_1stn_dayclm_pd_elnino_2d = linint2_points(lon,lat,modvar_pd_elnino,False,inlon,inlat,0)<br> mod_pointdata_1stn_dayclm_pd_elnino = mod_pointdata_1stn_dayclm_pd_elnino_2d(:,0)<br><br>; now create a single data variable that holds all six <br>; data arrays that you would like to plot<br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br><br> data = new((/2,27/),"float")<br> <br> ; rank order all of the data so you can compute percentiles<br> data(0,:) = obs_pointdata_1stn_dayclm_pd_elnino<br> data(1,:) = mod_pointdata_1stn_dayclm_pd_elnino<br><br> ;create a dummy time variable (integer days: 1 = Dec 1, 90 = Feb 28)<br> intday = ispan(1,27,1)<br><br>;**************************************<br>; Create plot<br>;***************************************<br> ;open the image. Note you can choose pdf, ps, png, ncgm or x11 format. (x11 prints to screen)<br> wks = gsn_open_wks ("x11","xy_"+inloc+"_tas") ; open workstation<br><br> ;Set the resources for the plot Text<br> res = True ; plot mods desired<br><br> ;Text strings for title and axes<br> res@tiMainString = inloc+": DJF El Nino vs La Nina: tas" ; Title at top of plot<br> res@tiYAxisString = "tas (deg_C)" ; Y-axis title<br> res@tiXAxisString ="Day of DJF" <br><br> ;Line colors/types<br> res@xyLineThicknesses = (/3.,2./) ; make 2nd lines thicker<br> res@xyLineColors = (/"red","blue"/) ; change line color<br> res@xyDashPatterns = (/0,5/) ; Make curves all solid<br><br> ;Make the plot<br> plot = gsn_csm_xy (wks,intday,data,res) ; create plot<br><br><br>end<br><br></div><br><span style="color:rgb(0,0,255)">And when I want to run it, this message appear:</span><br><br><span style="color:rgb(255,0,0)">fatal:No coordinate variable exists for dimension (lat) in variable (modvar_pd_elnino)<br>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 131 in file serie_tiempo.ncl</span><br><br></div><span style="background-color:rgb(243,243,243)">would you please give me some advices for this problem?, thank for your time.<br></span></div><span style="background-color:rgb(243,243,243)"><br>Jesus</span><br><br></div>
</blockquote></div><br></div>