[ncl-talk] CMC snow depth process
Bian Qingyun
bianqy at tea.ac.cn
Thu Feb 8 03:25:48 MST 2018
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180208/2e74405f/attachment.html>
More information about the ncl-talk
mailing list