[ncl-talk] How to make time series plot from satellite swath files of multiple days

Krishnakumar AP krishnaap7 at gmail.com
Tue Feb 27 22:23:29 MST 2018


Thanks a lot for your help. But I am stuck at some point. I have MODATML2
modis data swaths, from December 21 to December 31. The data I have
downloaded contains 6-9 files per day. So when I do "cat" it is making
problem. What to do? Could you please tell me?
I am quoting my sample ncl code below.

load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
>   ;::::::::::::::::::::::::::::::::::
>   diri = "./"
>   fils=systemfunc("cd "+diri+"; ls MODATML2.A2011*.hdf")
>   print(fils)
>   print("---")
>   nfils = dimsizes(fils)
>
>   varName = "Cloud_Top_Pressure"              ; hdf
>   ;varName = "Cloud_Water_Path_1621"        ; he2
>
>   pltType = "png"
>   pltName = "bin_modis_cwp_355"
>   pltDir  = "./"
>
>   ;:::::::::::::::::::::::::::::::::::::::::::
> ctp&TIME= ispan(21,31,1)
>
>
> ;:::::::::::::::::::::::::::::::::::::::::::::
>
>   wks=gsn_open_wks(pltType, pltDir+pltName)
>
>
>  res=True                                     ; plot mods desired
>  ;res at gsnMaximize = True                       ; make plot large
>   res at gsnFrame    = False                      ; don't advance frame
>   res at gsnDraw = False
>  restick= True
> restick at ttmFormat= "%D/%c/%Y"
> time_axis_labels(cl&TIME,res,restick)
>
>
>   ;::::::ZOOM:::::::::::;
> ;  res at mpMinLatF = 26.50
> ;  res at mpMaxLatF = 26.52
> ;  res at mpMinLonF = 80.22
> ;  res at mpMaxLonF = 80.24
>
> ;cld=dim_avg_n_Wrap(cl,(/26.51,80.23/)
>
>   ;:::::::::::::Title&Plotting::::::::::::::::
>   res at tiMainString=varName                      ; create title
>
>   plot1=gsn_csm_xy(wks,ctp&TIME,ctp(:,:),res)
>
>   res at cnLinesOn         =False                 ; turn off contour lines
>  ;res at cnLineLabelsOn    =True                  ; default; turn off
> contour line labels
>  ;res at gsnSpreadColors   =True                  ; default; use the entire
> color spectrum
>   res at cnFillOn          =True                  ; enable contour fill
>   res at cnMissingValFillPattern = 0
>   res at cnFillMode        ="RasterFill"
>   res at cnLevelSelectionMode = "ManualLevels"
>   res at cnMinLevelValF       = 10             ; min level
>   res at cnMaxLevelValF       = 10000            ; max level
>   res at cnLevelSpacingF      = 1000             ; contour interval
>   res at pmLabelBarOrthogonalPosF = 0.075
>   res at tiMainOn = False
>   res at gsnLeftString = ""
>   res at gsnRightString = ""
>   res at lbLabelFontHeightF = 0.012
>   plot2 = new(nfils,graphic)
>
>   do nf=0,nfils-1
>      print("")
>      print("***********************")
>      print("===> "+ fils(nf) + "<===")
>      print("***********************")
>      print("")
>
>      f   = addfile(diri+fils(nf),"r")
>     ;f   = addfile(diri+fils(nf)+".he2","r")
>      ListSetType(f,"cat")
>      cl = f[:]->$varName$
>      printVarSummary(cl)                        ; Look at variable
>      printMinMax(cl,0)
>      print("-----")
>                                                 ; each swath has different
> lat/lon
>      lat2d = f->Latitude                        ; hdf
>      lon2d = f->Longitude
>     ;lat2d = f->Latitude_mod06                  ; he2
>     ;lon2d = f->Longitude_mod06
>
>      printVarSummary(lat2d)                     ; Look at variable
>      printMinMax(lat2d,0)
>      print("-----")
>      printVarSummary(lon2d)                     ; Look at variable
>      printMinMax(lon2d,0)
>      print("-----")
>
>      cl at lat2d = lat2d                           ; attach for plot
>      cl at lon2d = lon2d
>
>      ctp =  cl(0,{26.51},{80.23})
>
>
>   end do    ; end file loop
>   draw(plot)
>   frame(wks)             ; advance frame
>

On Tue, Feb 27, 2018 at 10:11 AM, Guido Cioni <guidocioni at gmail.com> wrote:

> The question is general and involve different steps. There are a lot of
> examples on the NCL website, you should first try following those.
>
> Specifically,
>
> [1] reading HDF data (https://www.ncl.ucar.edu/Applications/HDF.shtml)
> possibly concatenating them (https://www.ncl.ucar.edu/
> Applications/addfiles.shtml) so you already have all the timesteps.
> Otherwise you'd have to loop over the file and then concatenate the
> variable afterwards (https://www.ncl.ucar.edu/Document/Functions/
> Contributed/array_append_record.shtml).
>
> [2] extract a lat-lon point from the variable that you're reading.
> var_point=var({lat_point},{lon_point}) assuming that the variable has
> coordinate variables attached (https://www.ncl.ucar.edu/
> Document/Language/subscript_coord.shtml), otherwise you have to find the
> cell index by yourself (some hint https://www.ncl.ucar.edu/
> Document/Functions/Built-in/ind.shtml). You should also develop an
> if-condition that checks whether the point is included in the swath: I
> believe that your satellite data is sparse so maybe the point that you're
> looking at is not always included in the swath... I  would suggest to
> assign a _FillValue to the variable if this point is not found so that you
> can plot the timeseries easily.
>
> [3] Do a timeseries with gsm_csm_xy, mabye format the x-axis using
> time_axis_labels (https://www.ncl.ucar.edu/Document/Functions/User_
> contributed/time_axis_labels.shtml).
>
> I believe you have enough to start working now.
>
> Cheers
>
>
>
>
> On 26. Feb 2018, at 15:51, Krishnakumar AP <krishnaap7 at gmail.com> wrote:
>
> Hello NCL Community,
>  I want to make a time series plot from HDF satellite swaths of multiple
> days, how to do that? I want to take time series values of Cloud water path
> from a specific lat and long and make into a time series plot. Could you
> please guide me? Thanks in advance
>
> --
>
> Thankfully
> Krishnakumar.AP
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> Guido Cioni
> http://guidocioni.altervista.org
>
>


-- 

Best regards
Krishnakumar.AP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180228/e4fc7696/attachment.html>


More information about the ncl-talk mailing list