<div dir="ltr"><div><div><div>Without the data, it is hard to know if the attached would work.<br><br></div>NOTE: To plot curvilinear grids you should attach the two reserved attribute 'lat2d' and 'lon2d' to the data array.<br><br>---<br></div>The NCL User Guide at:<br><br><a href="https://www.ncl.ucar.edu/Document/Manuals/">https://www.ncl.ucar.edu/Document/Manuals/</a><br><br></div>has examples.<br><br>---<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 8, 2018 at 3:25 AM, Bian Qingyun <span dir="ltr"><<a href="mailto:bianqy@tea.ac.cn" target="_blank">bianqy@tea.ac.cn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p><br>Hi,</p>
<p>Have anyone ever processed a year of Canadian Meteorological Centre (CMC) Daily Snow Depth Analysis Data, in ascii format, into netcdf using NCL? If you did, could you share your script with me? </p>
<p>I tried to process a day of CMC snow depth data and plot it using the following script which is similar to the script on NCL website <a href="http://www.ncl.ucar.edu/Applications/nic_ims.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/nic_ims.shtml</a> . But the coordinates of the snow depth was wrong in the plot.</p>
<p>------------------------------<wbr>-</p>
<p>begin</p>
<p>nrows = 706<br>ncols = 706</p>
<p>cda = asciiread("cmc_analysis_ps_<wbr>lat_long.txt",-1,"string")<br>llat = tofloat(str_get_field(cda(9:),<wbr>3," "))<br>llon = tofloat(str_get_field(cda(9:),<wbr>4," "))</p>
<p>lat = onedtond(llat,(/nrows,ncols/))<br>lon = onedtond(llon,(/nrows,ncols/))</p>
<p>dummy = asciiread("cmc_analysis_2003.<wbr>txt",-1,"float")<br>data = onedtond(dummy(1:498436),(/<wbr>nrows,ncols/))<br></p>
<p>fout = addfile("<a href="http://cmc_20030101_2.nc" target="_blank">cmc_20030101_2.nc</a>","<wbr>c")<br>fout->sd = data</p>
<p>;-----plot</p>
<p>wks = gsn_open_wks("png","nic_cmc") <wbr> ; send graphics to PNG file</p>
<p> res = True<br> <a href="mailto:res@cnFillOn" target="_blank">res@cnFillOn</a> = True<br> <a href="mailto:res@cnLinesOn" target="_blank">res@cnLinesOn</a> = False<br> <a href="mailto:res@cnLineLabelsOn" target="_blank">res@cnLineLabelsOn</a> = False<br> <a href="mailto:res@cnFillMode" target="_blank">res@cnFillMode</a> = "rasterfill"<br> <a href="mailto:res@cnMissingValFillColor" target="_blank">res@cnMissingValFillColor</a> = "gray"</p>
<p> <a href="mailto:res@cnLevelSelectionMode" target="_blank">res@cnLevelSelectionMode</a> = "explicitlevels"<br> <a href="mailto:res@cnLevels" target="_blank">res@cnLevels</a> = (/ 5,10,40,100,200 /)<br> <a href="mailto:res@cnFillBackgroundColor" target="_blank">res@cnFillBackgroundColor</a> = "gray"<br> <a href="mailto:res@cnFillColors" target="_blank">res@cnFillColors</a> = (/"transparent", "blue", "darkgreen", "cyan", "white"/)<br> <a href="mailto:res@lbLabelAlignment" target="_blank">res@lbLabelAlignment</a> = "boxcenters"<br> <a href="mailto:res@cnExplicitLabelBarLabelsOn" target="_blank">res@cnExplicitLabelBarLabelsOn</a> = True<br> <a href="mailto:res@cnLabelBarEndStyle" target="_blank">res@cnLabelBarEndStyle</a> = "excludeouterboxes"<br> <a href="mailto:res@lbAutoManage" target="_blank">res@lbAutoManage</a> = False<br> <a href="mailto:res@lbLabelFontHeightF" target="_blank">res@lbLabelFontHeightF</a> = 0.02</p>
<p> <a href="mailto:res@gsnCenterString" target="_blank">res@gsnCenterString</a> = "CMC 24k product"<br> <a href="mailto:res@gsnCenterStringFontHeightF" target="_blank">res@gsnCenterStringFontHeightF</a> = 0.03<br> <a href="mailto:res@gsnMaximize" target="_blank">res@gsnMaximize</a> = True</p>
<p> do i = 0, nrows - 1<br> if (all(data(:,i) .eq. <a href="mailto:data@_FillValue" target="_blank">data@_FillValue</a>)) then<br> continue<br> end if<br> break<br> end do<br> do j = 0, ncols - 1<br> if (all(data(j,:) .eq. <a href="mailto:data@_FillValue" target="_blank">data@_FillValue</a>)) then<br> continue<br> end if<br> break<br> end do</p>
<p> <a href="mailto:res@tfDoNDCOverlay" target="_blank">res@tfDoNDCOverlay</a> = True<br> <a href="mailto:res@cnMissingValFillColor" target="_blank">res@cnMissingValFillColor</a> = "white"<br> <a href="mailto:res@mpCenterLonF" target="_blank">res@mpCenterLonF</a> = -80<br> <a href="mailto:res@mpOutlineBoundarySets" target="_blank">res@mpOutlineBoundarySets</a> = "national"<br> <a href="mailto:res@mpEllipticalBoundary" target="_blank">res@mpEllipticalBoundary</a> = True<br> <a href="mailto:res@mpPerimDrawOrder" target="_blank">res@mpPerimDrawOrder</a> = "postdraw"<br> <a href="mailto:res@gsnAddCyclic" target="_blank">res@gsnAddCyclic</a> = False<br> <a href="mailto:res@gsnPolar" target="_blank">res@gsnPolar</a> = "NH"</p>
<p>plot = gsn_csm_contour_map_polar(wks,<wbr>data(j:ncols-j-1,i:nrows-i-1),<wbr>res)<br>end</p>
<p>------------------------------<wbr>-----</p>
<p>Thank you very much!</p><span class="HOEnZb"><font color="#888888">
<p>Qingyun</p></font></span><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>