;--------------------------------------------------------------------- ; Read and plot one flight ;--------------------------------------------------------------------- ;---read the data and define ;---https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml diri = "/home/model-user/Desktop/" fili = "IAGOS_timeseries_2002021617203349.nc" pthi = diri+fili f = addfile(pthi, "r") var = f->O3_PM ; var(UTC_time) printVarSummary(var) print("min/max var = " + min(var) + "/" + max(var)) print("---") print("min/max var&UTC_time = " + min(var&UTC_time) + "/" + max(var&UTC_time)) print("---") printMinMax(var&UTC_time,0) print("---") ;---Gregorian calendar ;---https://www.ncl.ucar.edu/Document/Functions/Built-in/cd_calendar.shtml ymdhs = cd_calendar(var&UTC_time, 0) ; type double printVarSummary(ymdhs) print("---") ymdhs:= toint(ymdhs) ; overwrite := ; type integer: convenience printVarSummary(ymdhs) print("---") ;---Extract assorted information ;---https://www.ncl.ucar.edu/Document/Functions/Built-in/str_get_field.shtml filRoot = str_get_field(fili, 1, ".") fltName = f@flight_name depAir = str_get_field(f@departure_airport, 1, ",") ; departure airport ID arrAir = str_get_field(f@arrival_airport , 1, ",") ; arroval airport ID print("depAir="+depAir+" arrAir="+arrAir+" filRoot="+filRoot) print("---") ;---Graphics pltType = "png" pltName = "O3_PM_"+depAir+"-to-"+arrAir+"_"+fltName pltDir = "./" pltPath = pltDir + pltName wks = gsn_open_wks(pltType, pltPath) res = True res@gsnMaximize = True ;res@xyExplicitLegendLabels = (/"Ozone at Lagos"/) ; why? res@xyLineColor = (/"red"/) res@xyLineThicknessF = 3 res@tiYAxisString = "O3_PM ppb" ;;res@tiXAxisString = "UTC Time" res@tiMainString = pltName ; "Ozone_PM: Lagos to Lome flight" res@trYMinF = 15. res@trYMaxF = 100.0 ;---Different plot options plot = gsn_xy(wks, var&UTC_time, var, res) ;-- create plot TIME = var&UTC_time - var&UTC_time(0) ; rebase time: time since flight start TIME@long_name = "seconds since "+ymdhs(0,0)+"/" \ ; yyyy +ymdhs(0,1)+"/" \ ; mm +ymdhs(0,2)+"/" \ ; dd +ymdhs(0,3)+"/" \ ; hh +ymdhs(0,4)+"/" \ ; mn +ymdhs(0,5) ; sc plot = gsn_xy(wks, TIME, var, res) ;-- create plot