[ncl-talk] CMC snow depth process

Dennis Shea shea at ucar.edu
Fri Feb 9 08:36:01 MST 2018


Without the data, it is hard to know if the attached would work.

NOTE: To plot curvilinear grids you should attach the two reserved
attribute 'lat2d' and 'lon2d' to the data array.

---
The NCL User Guide at:

https://www.ncl.ucar.edu/Document/Manuals/

has examples.

---

On Thu, Feb 8, 2018 at 3:25 AM, Bian Qingyun <bianqy at tea.ac.cn> wrote:

>
> Hi,
>
> 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?
>
> 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
> http://www.ncl.ucar.edu/Applications/nic_ims.shtml . But the coordinates
> of the snow depth was wrong in the plot.
>
> -------------------------------
>
> begin
>
> nrows = 706
> ncols = 706
>
> cda = asciiread("cmc_analysis_ps_lat_long.txt",-1,"string")
> llat = tofloat(str_get_field(cda(9:),3," "))
> llon = tofloat(str_get_field(cda(9:),4," "))
>
> lat = onedtond(llat,(/nrows,ncols/))
> lon = onedtond(llon,(/nrows,ncols/))
>
> dummy = asciiread("cmc_analysis_2003.txt",-1,"float")
> data = onedtond(dummy(1:498436),(/nrows,ncols/))
>
> fout = addfile("cmc_20030101_2.nc","c")
> fout->sd = data
>
> ;-----plot
>
> wks = gsn_open_wks("png","nic_cmc")     ; send graphics to PNG file
>
>   res = True
>   res at cnFillOn = True
>   res at cnLinesOn = False
>   res at cnLineLabelsOn = False
>   res at cnFillMode = "rasterfill"
>   res at cnMissingValFillColor = "gray"
>
>   res at cnLevelSelectionMode = "explicitlevels"
>   res at cnLevels = (/ 5,10,40,100,200 /)
>   res at cnFillBackgroundColor = "gray"
>   res at cnFillColors = (/"transparent", "blue", "darkgreen", "cyan",
> "white"/)
>   res at lbLabelAlignment = "boxcenters"
>   res at cnExplicitLabelBarLabelsOn = True
>   res at cnLabelBarEndStyle = "excludeouterboxes"
>   res at lbAutoManage = False
>   res at lbLabelFontHeightF = 0.02
>
>   res at gsnCenterString = "CMC 24k product"
>   res at gsnCenterStringFontHeightF = 0.03
>   res at gsnMaximize = True
>
>   do i = 0, nrows - 1
>    if (all(data(:,i) .eq. data at _FillValue)) then
>        continue
>    end if
>    break
>   end do
>   do j = 0, ncols - 1
>    if (all(data(j,:) .eq. data at _FillValue)) then
>        continue
>    end if
>    break
>   end do
>
>  res at tfDoNDCOverlay = True
>   res at cnMissingValFillColor = "white"
>   res at mpCenterLonF = -80
>   res at mpOutlineBoundarySets = "national"
>   res at mpEllipticalBoundary = True
>   res at mpPerimDrawOrder = "postdraw"
>   res at gsnAddCyclic = False
>   res at gsnPolar = "NH"
>
> plot = gsn_csm_contour_map_polar(wks,data(j:ncols-j-1,i:nrows-i-1),res)
> end
>
> -----------------------------------
>
> Thank you very much!
>
> Qingyun
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180209/b90b32b4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmc_ncl_talk.ncl
Type: application/octet-stream
Size: 2867 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180209/b90b32b4/attachment-0001.obj>


More information about the ncl-talk mailing list