<div dir="ltr"><div class="gmail_default" style="font-size:small">Rabah,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I think the shift is happening because you are trying to draw the vectors and map as two separate plots. This will cause the vectors to not be drawn in the correct map projection.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">There are a number of other unrelated issues that I feel I should point out, because it's hard to tell what your code is supposed to do:</div>
<div class="gmail_default" style="font-size:small"><ul><li>You've got triple do loops, but then the code inside the loops are randomly indented, so it's hard to tell what's going on.<br><br></li><li>You have some code inside a do loop that really shouldn't be there. If you have code that doesn't change inside of a do loop, then it should be moved outside the do loop. Otherwise this can cause your code to run much slower.<br>
<br></li><li>You are reading lat/lon separately off the file, but I don't think you need to do this, because you have "rectilinear" data. But, I'll leave that alone for now.<br><br></li><li>You are calling area_conserve_remap_Wrap to regrid some data, but then you never do anything with this data.</li>
</ul></div><div class="gmail_default" style="font-size:small">Please, in the future, if you send a script, please try to clean it up so that the code has some level of indentation. It is very hard to look at someone else's code if there are triple do loops, and no indentation.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">But, to deal with the vector/map problem first: I suggest using gsn_csm_vector_map, instead of gsn_csm_map and gsn_csm_vector separately. This will make sure your wind barbs get projected into the map space correctly.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I've tried to modify your script to do this, but without your data, I can't be sure it's going to run correctly. I've attached the script.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 27, 2014 at 6:06 PM, Rabah Hachelaf <span dir="ltr"><<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Mary,<div><br></div><div>Your recommendations were very helpful. <br><div><br></div><div>My real purpose is to write a generalized script plots wind barbs and temperature values over a predefined sub domains.</div>
<div><br></div><div>my script (attached) reads geographical limits from the file : sub_domain.data which contains these data :</div><div><div>1 -180 0 -90 0</div><div>2 0 180 -90 0</div><div>3 -180 0 0 90</div><div>4 0 180 0 90</div>
</div><div>nlat and nlon represent number of plots needed over latitude and longitude axes <br></div><div><br></div><div>For now my script works and plot desired data for the 4 sub domains but i have problem to coincide wind barbs plot with temperature values, temperature plot seems to shift like in image attached. </div>
<div><br></div><div>Thanks.</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-27 14:55 GMT-04:00 Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</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 style="font-size:small">Rabah,</div><div style="font-size:small"><br></div><div style="font-size:small">
There are a series of issues with your script, but not all of them have to do with why your code is taking so long.</div>
<div style="font-size:small"><br></div><div style="font-size:small">1. You have mpMaxLatF and mpMinLatF set to the same value.</div><div style="font-size:small">
<br></div><div style="font-size:small">2. You've set gsnDraw to False, which will cause no text strings to be added:</div><div style="font-size:small"><br></div><div style="font-size:small"><div>
<div style="font-family:arial,sans-serif;font-size:13px"> txres@gsnDraw = False ; do not draw the plot</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div></div><div style="font-family:arial,sans-serif;font-size:13px">
3. <span style="font-size:small;font-family:arial">The txres@txFontThicknessF = 10 is going to cause your text strings to be 10x as thick. Do you want this on top of the text being bold-faced?</span></div><div style="font-family:arial,sans-serif;font-size:13px">
<span style="font-size:small;font-family:arial"><br></span></div><div>4. You are adding almost 260,000 strings to the plot. Is what you mean to do? </div><div><br></div><div>5. You are constructing the lat2d/lon2d arrays in two separate do loops. You can make this code simpler by using "conform_dims".</div>
<div><br></div><div>6. Using gsn_add_text is going to cause 259920 graphical objects to be created, because one has to be added for every string you create. This can get very memory intensive.</div><div><br></div><div>If you are only planning to draw this one plot and not resize it later, then I suggest using gsn_text instead of gsn_add_text. This will prevent the individual objects from being created, and will run faster. </div>
<div><br></div><div>See the attached script. I didn't clean up the code to fix the various warnings from setting contour resources when you are only creating a map script, because I figured you were in the middle of debugging this. But, I did clean it up to make it run faster. This script took about 71 seconds on my Mac. If you take out the "txFontThicknessF" setting, then it runs in about 62 seconds.</div>
<div><br></div><div>Note that I put the "gsn_text" call inside a single do loop. This seems to run faster than using a double do loop, or no do loop at all. I think this has to do with trying to add 259,000+ strings to a plot all at once versus adding each string one at a time. Instead, I'm adding 360 strings at a time, for each 720 iterations, which seems to be a happy balance.</div>
<div><br></div><div>--Mary</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Sun, Jul 27, 2014 at 1:25 AM, Rabah Hachelaf <span dir="ltr"><<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hi NCL users, <div><br></div><div>I am using the ncl script below to plot temperature values from GFS data,</div>
<div>this script works great when i regrid my data to a lower resolution.</div><div>but when i want plotting the whole data (720 x 361 values) and after more than 3 hours, ncl still running without generate any image or error message.</div>
<div>this very strange since NCL is supposed to be a powerful tool. </div><div><br></div><div>Have you any suggest to this problem.</div><div><br></div><div>Thanks a lot.</div><div><br></div><div>Rabah</div><div><br></div>
<div><div>;************************************************</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" </div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" </div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" </div><div>;************************************************</div><div> a = addfile("gfs.t00z.pgrb2f00.grib2","r")</div><div>
lon = a->lon_0</div><div> lat = a->lat_0</div><div> tt = short2flt(a->TMP_P0_L100_GLL0({100000},:,:))</div><div> tt = (/tt-273/)</div><div><br></div><div>lat2d= new((/361,720/),float)</div><div>
;********* create 2D lat lon </div><div>do l=0,719</div><div> lat2d(:,l)=lat(:)</div><div>end do</div><div><br></div><div>lon2d= new((/361,720/),float)</div><div>do l=0,360</div><div> lon2d(l,:)=lon(:)</div><div>end do</div>
<div>;******************************************</div><div>wks_type="png"</div><div><br></div><div> wks_type@wkWidth = 4000</div><div> wks_type@wkHeight = 4000</div><div><br></div><div> wks = gsn_open_wks(wks_type,"plot_val") </div>
<div> gsn_define_colormap(wks,"gui_default")</div><div> </div><div> res = True ; plot mods desired</div><div>res@pmTickMarkDisplayMode = "Always"</div><div> res@mpProjection = "Mercator" ; choose projection</div>
<div> res@mpGridAndLimbOn = False ; turn on lat/lon lines</div><div> res@mpPerimOn = True ; turn off box around plot</div><div> res@mpGridLatSpacingF = 45. ; spacing for lat lines</div>
<div> res@mpGridLonSpacingF = 45. ; spacing for lon lines</div><div> res@mpFillOn = False</div><div> res@mpLimitMode = "LatLon"</div><div> res@mpMinLatF = 85.0</div><div>
res@mpMaxLatF =85.0 </div><div> res@mpMinLonF = -180</div><div> res@mpMaxLonF = 180</div><div> </div><div> res@cnFillOn = False ; color plot desired</div>
<div>
res@cnLineLabelsOn = False ; turn off contour lines</div><div><br></div><div> res@vpXF = 0 ; make plot bigger</div><div> res@vpYF = 1 </div><div> res@vpWidthF = 1</div>
<div> res@vpHeightF = 1</div><div>map = gsn_csm_map(wks,res)</div><div> txres = True</div><div> txres@txFontQuality = True</div><div> txres@txFontHeightF = 0.00125</div><div> txres@txFont = "helvetica-bold"</div>
<div> txres@txFontColor =1</div><div> txres@txFontThicknessF= 10</div><div> txres@gsnDraw = False ; do not draw the plot</div><div> txres@gsnFrame = False</div><div>text = gsn_add_text(wks,map,sprintf("%2.0f", tt) , lon2d, lat2d,txres)</div>
<div>draw(wks) ; Now draw map with text strings and</div><div>frame(wks) ; advance the frame</div><div>end</div><span class="HOEnZb"><font color="#888888"><span><font color="#888888">-- <br><div dir="ltr"><div>------------------------------</div>
Cordialement,<br>Best regards,<br>Rabah Hachelaf <br>
</div>
</font></span></font></span></div></div><span class="HOEnZb"><font color="#888888">
<br></font></span></div></div><span class="HOEnZb"><font color="#888888">_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>------------------------------</div>Cordialement,<br>Best regards,<br>Rabah Hachelaf <br>
</div>
</font></span></div></div>
</blockquote></div><br></div>