; ncl-talk: 17 February 2020: Vanucia Schumacher ; "I would like to know how I can extract the date information (YYYYMMDD) and coords (LAT LON) ; for each non-missing value from the variable obtained? ; ; And how could I plot these points, because they are 14 valid pixels (cells-size) ; and when I plot only 1 pixel appears ;======================================================================================= ; Comment: ; The source array is VERY SPARSELY populated: 99.9999999% of values are missing ; The mean array has 99.9995% missing. ; ; Graphics Response: Raster mode requires 4 'adjacent' grid values to be non-missing ; The data do npt support this requirement ; ; Solution: Plot imdividual polymarkers. ;====================================================================================== ;----- Data dir = "./" filroot = "nfr_2017_1km" fil = systemfunc("cd "+dir+" ; ls "+filroot+".nc") pth = dir+fil dat = addfiles(pth,"r") rname = "nfr" r = dat[:]->$rname$ ;;r@_FillValue = -999 ; why? r@long_name = "nfr" printVarSummary(r) ; [time | 365] x [lat | 1410] x [lon | 1840] printMinMax(r,0) ;----- Time mean at each grid point xSumTime = dim_sum_n_Wrap( r, 0 ) printVarSummary(xSumTime) ; (1410,1840) printMinMax(xSumTime,0) ; min=1 max=3 ymdh = cd_calendar(r&time,-3) ; [365]=> yyyymmddhh ;;print(ymdh) ;;print("-------------------------") ;-----Print YMDH (TIME), LAT, LON, R for non-Missing values ;;YMDH = conform(r,ymdh ,0) ; broadcast (replicate); (365,1410,1840] ;;LAT = conform(r,r&lat,1) ; broadcast (replicate) ;;LON = conform(r,r&lon,2) ; broadcast (replicate) r1d = ndtooned(r) ymdh1d = ndtooned( conform(r,ymdh ,0) ) lat1d = ndtooned( conform(r,r&lat,1) ) lon1d = ndtooned( conform(r,r&lon,2) ) ;;delete(r) ; no longer needed and it is a big array ivalid = ind(.not.ismissing(r1d)) ; 1D indices of non-missing values. print(ymdh1d(ivalid)+" "+lat1d(ivalid)+" "+lon1d(ivalid)+" "+r1d(ivalid)) print("-------------------------") ;---- Plot wks = gsn_open_wks("png","nfr_2017") lonW = -60 lonE = -38 latS = -30 latN = -10 res = True res@gsnFrame = False res@gsnMaximize = True res@mpMinLatF = latS res@mpMaxLatF = latN res@mpMinLonF = lonW res@mpMaxLonF = lonE res@tiMainString = filroot res@tiMainFontHeightF = 0.020 ; 0.0250 id default res@gsnCenterString = "Red=1, Blue=2, Green=3" res@gsnCenterStringFontHeightF = 0.0125 ; dynamic map = gsn_csm_map(wks,res) gsres = True gsres@gsMarkerIndex = 16 ; Use filled dots for markers. gsres@gsMarkerSizeF = 0.008 ; 0.007 is default npts = dimsizes(ivalid) print("npts="+npts) do npt=0,npts-1 value = r1d(ivalid(npt)) if (value.eq.1) then gsres@gsMarkerColor = "Red" elseif (value.eq.2) then gsres@gsMarkerColor = "Blue" elseif (value.eq.3) then gsres@gsMarkerColor = "DarkGreen" end if gsn_polymarker(wks,map,lon1d(ivalid(npt)),lat1d(ivalid(npt)),gsres) end do frame(wks) ; Advance the frame.