From tabishumaransari at gmail.com Tue Oct 4 08:17:42 2022 From: tabishumaransari at gmail.com (Tabish Ansari) Date: Tue, 4 Oct 2022 16:17:42 +0200 Subject: [ncl-talk] ESMF regridding of global emissions: getting 300-800 times lower values on destination grid Message-ID: Hi I've got global emissions of various air pollutants for multiple years on a 0.1 x 0.1 degrees rectilinear grid which I'm trying to regrid at a coarser resolution of 1.9x2.5 degrees for a model run. I'm using the ESMF_regrid() and ESMF_regrid_with_weights() functions to achieve the desired output but on evaluation I find that the output files have much lower magnitudes of emissions inside: sum of all grid boxes on the destination grid is roughly 300-800 times lower than that for the source grid . The units are in tons/month. Here's my first script that I use to generate the weights file: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl" begin sfile = addfile("/data/sync/modelinput/HTAPv3-Emissions-tan/edgar_HTAPv3_2018_NOx.nc","r") nox = sfile->HTAPv3_1_International_Shipping(0,:,:) Opt = True Opt at ForceOverwrite = True Opt at InterpMethod = "conserve" Opt at DstGridType = "1.9x2.5" Opt at DstURCorner = (/ 90, 357.5/) Opt at DstLLCorner = (/ -90, 0/) nox_regrid = ESMF_regrid(nox,Opt) printVarSummary(nox_regrid) end This creates 3 files: destination_grid_file.nc source_grid_file.nc weights_file.nc Further, I utilize the weights_file.nc to perform the regridding using the following script: begin SDIR = "/data/sync/modelinput/HTAPv3-Emissions-tan/" DDIR = "/data/sync/modelinput/HTAPv3-Emissions-tan_regridMC/" prefix = "edgar_HTAPv3_20" yeararray = (/"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18"/) polarray = (/"CO","NMVOC","NOx","SO2","NH3","OC","BC","PM2.5","PM10"/) do t=0,18 ;LOOP OVER YEARS do p=0,8 ;LOOP OVER POLLUTANTS fname = prefix+yeararray(t)+"_"+polarray(p)+".nc" print("Regridding: "+fname) sfile = addfile(SDIR+fname,"r") dfile = addfile(DDIR+fname,"c") sec1 = sfile->HTAPv3_1_International_Shipping sec2 = sfile->HTAPv3_2_1_Domestic_Aviation sec3 = sfile->HTAPv3_2_2_International_Aviation sec4 = sfile->HTAPv3_3_Energy sec5 = sfile->HTAPv3_4_1_Industry sec6 = sfile->HTAPv3_4_2_Fugitive sec7 = sfile->HTAPv3_4_3_Solvents sec8 = sfile->HTAPv3_5_1_Road_Transport if(p.gt.4)then sec9 = sfile->HTAPv3_5_2_Brake_and_Tyre_wear end if sec10 = sfile->HTAPv3_5_3_Domestic_shipping sec11 = sfile->HTAPv3_5_4_Other_ground_transport sec12 = sfile->HTAPv3_6_Residential sec13 = sfile->HTAPv3_7_Waste sec14 = sfile->HTAPv3_8_1_Agricultural_waste_burning sec15 = sfile->HTAPv3_8_3_Agriculture_crops ;REGRIDDING sec1_regrid = ESMF_regrid_with_weights(sec1,"weights_file.nc",False) sec2_regrid = ESMF_regrid_with_weights(sec2,"weights_file.nc",False) sec3_regrid = ESMF_regrid_with_weights(sec3,"weights_file.nc",False) sec4_regrid = ESMF_regrid_with_weights(sec4,"weights_file.nc",False) sec5_regrid = ESMF_regrid_with_weights(sec5,"weights_file.nc",False) sec6_regrid = ESMF_regrid_with_weights(sec6,"weights_file.nc",False) sec7_regrid = ESMF_regrid_with_weights(sec7,"weights_file.nc",False) sec8_regrid = ESMF_regrid_with_weights(sec8,"weights_file.nc",False) if(p.gt.4)then sec9_regrid = ESMF_regrid_with_weights(sec9,"weights_file.nc",False) end if sec10 = sfile->HTAPv3_5_3_Domestic_shipping sec11 = sfile->HTAPv3_5_4_Other_ground_transport sec12 = sfile->HTAPv3_6_Residential sec13 = sfile->HTAPv3_7_Waste sec14 = sfile->HTAPv3_8_1_Agricultural_waste_burning sec15 = sfile->HTAPv3_8_3_Agriculture_crops ;STORING dfile->HTAPv3_1_International_Shipping = sec1_regrid dfile->HTAPv3_2_1_Domestic_Aviation = sec2_regrid dfile->HTAPv3_2_2_International_Aviation = sec3_regrid dfile->HTAPv3_3_Energy = sec4_regrid dfile->HTAPv3_4_1_Industry = sec5_regrid dfile->HTAPv3_4_2_Fugitive = sec6_regrid dfile->HTAPv3_4_3_Solvents = sec7_regrid dfile->HTAPv3_5_1_Road_Transport = sec8_regrid if(p.gt.4)then dfile->HTAPv3_5_2_Brake_and_Tyre_wear = sec9_regrid end if dfile->HTAPv3_5_3_Domestic_shipping = sec10_regrid dfile->HTAPv3_5_4_Other_ground_transport = sec11_regrid dfile->HTAPv3_6_Residential = sec12_regrid dfile->HTAPv3_7_Waste = sec13_regrid dfile->HTAPv3_8_1_Agricultural_waste_burning = sec14_regrid dfile->HTAPv3_8_3_Agriculture_crops = sec15_regrid end do end do end I'd be grateful if you could please point out what's going wrong here. Thanks a lot. Cheers, Tabish ------------------------------- Dr Tabish Ansari Research Associate Air Quality Modelling Group IASS-Potsdam Germany -------------- next part -------------- An HTML attachment was scrubbed... URL: From asphilli at ucar.edu Tue Oct 4 09:53:41 2022 From: asphilli at ucar.edu (Adam Phillips) Date: Tue, 4 Oct 2022 09:53:41 -0600 Subject: [ncl-talk] ExcludeOuterBoxes in gsn_create_labelbar In-Reply-To: <25acc2df.13675.183858ce6d7.Webtop.46@tim.it> References: <25acc2df.13675.183858ce6d7.Webtop.46@tim.it> Message-ID: Hi Giorgio, You can try setting lbLabelAlignment to "ExternalEdges" which I believe will produce the same results as cnLabelBarEndStyle. See example #14 here: https://www.ncl.ucar.edu/Applications/labelbar.shtml#ex14 Or see many other examples where this resource is set: https://www.ncl.ucar.edu/Applications/res_list.shtml#lbLabelAlignment Hope that helps! Adam On Wed, Sep 28, 2022 at 1:22 PM Giorgio Graffino via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Dear NCL Community, > > > I'm trying to set the resource cnLabelBarEndStyle to "ExcludeOuterBoxes" > while calling gsn_create_labelbar, to get ride of the labelbar boxes > bigger than 1 and smaller than -1 in the attached plot. However, since I'm > not drawing a contour plot, the resource doesn't do anything. I'm adapting > this example (https://www.ncl.ucar.edu/Applications/Scripts/table_8.ncl). > The procedure drawing the labelbar is shown below. > > > How can I solve the issue? I tried to look for a solution in the quick > search bar in https://www.ncl.ucar.edu/Support/posting_guidelines.shtml, > but it's always giving me the following error "The requested page could > not be found." > > > Cheers, > > Giorgio > > > undef("add_labelbar") > > procedure add_labelbar(wks,plot,cmap,labels,stride,title,location) > > local nboxes, vph, vpw, nboxes, lbres, lbid, amres, annoid > > begin > > nboxes = dimsizes(labels)+1 > > colors = span_color_rgba(cmap,nboxes) > > getvalues plot ; Get plot size for use in > > "vpHeightF" : vph ; creating labelbar. > > "vpWidthF" : vpw > > end getvalues > > ; > > ; Set some resources for a vertical or horizontal labelbar on the > > ; bottom or right axis. > > ; > > ; am_para/am_orth > > ; 0.0/ 0.0 - annotation in dead center of plot > > ; 0.5/ 0.5 - annotation at bottom right of plot > > ; 0.5/-0.5 - annotation at top right of plot > > ; -0.5/-0.5 - annotation at top left of plot > > ; -0.5/ 0.5 - annotation at bottom left of plot > > ; > > ; You will likely need to modify the am_para/am_orth > > ; values depending on your X and Y axis labels, the size > > ; of your plot, the number of rows and columns you have, et. > > ; > > if(any(location.eq.(/"bot1","bot2"/))) then > > orient = "horizontal" > > width = vpw * 0.95 ; slightly shorter than width of plot > > height = vph * 0.15 > > am_just = "BottomCenter" > > am_para = 0.0 ; Centered about X axis > > title_pos = "Top" > > if(location.eq."bot1") > > am_orth = 0.85 ; Move labelbar down > > else > > am_orth = 1.04 ; move further down > > end if > > else > > orient = "vertical" > > width = vpw * 0.15 > > height = vph * 0.95 ; slightly shorter than height of plot > > am_just = "TopLeft" > > am_orth = -0.5 ; Move labelbar up > > title_pos = "Left" > > if(location.eq."rgt2") > > am_para = 0.55 ; Move labelbar right > > else > > am_para = 0.78 ; move further right > > end if > > end if > > ; labelbar resources > > lbres = True > > lbres at lbAutoManage = False ; Necessary to control sizes > > lbres at vpWidthF = width > > lbres at vpHeightF = height > > lbres at cnLabelBarEndStyle = "ExcludeOuterBoxes" > > lbres at lbFillColors = colors ; labelbar colors > > lbres at lbMonoFillPattern = True ; Solid fill pattern > > lbres at lbLabelFontHeightF = 0.015 ; font height. Default is small > > lbres at lbLabelAlignment = "InteriorEdges" > > lbres at lbOrientation = orient > > lbres at lbTitleString = title > > lbres at lbPerimOn = False > > lbres at lbTitlePosition = title_pos > > lbres at lbLabelStride = stride > > lbid = gsn_create_labelbar(wks,nboxes,labels,lbres) > > ; annotation resources > > amres = True > > amres at amJust = am_just > > amres at amOrthogonalPosF = am_orth > > amres at amParallelPosF = am_para > > ; attach the labelbar to the plot > > plot at annoid = gsn_add_annotation(plot,lbid,amres) > > end > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -- Adam Phillips Associate Scientist IV, Climate Analysis Section Climate and Global Dynamics Laboratory National Center for Atmospheric Research www.cgd.ucar.edu/staff/asphilli/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From g.graffino at tim.it Wed Oct 5 08:40:28 2022 From: g.graffino at tim.it (Giorgio Graffino) Date: Wed, 5 Oct 2022 16:40:28 +0200 (CEST) Subject: [ncl-talk] ExcludeOuterBoxes in gsn_create_labelbar In-Reply-To: <25acc2df.13675.183858ce6d7.Webtop.46@tim.it> References: <25acc2df.13675.183858ce6d7.Webtop.46@tim.it> Message-ID: <44e59b12.411bb.183a8974057.Webtop.63@tim.it> Hi Adam, Thanks for the suggestion. I wasn't familiar with lbLabelAlignment. I adapted the last part of https://www.ncl.ucar.edu/Applications/Scripts/lb_14.ncl in the add_labelbar function. Now it looks like below, although I'm getting an error message. fatal:["NclAtt.c":262]:Attribute assignment type mismatch. I don't know from which part of the function the message is coming. The labelbar is correctly changed despite the message. Cheers, Giorgio undef("add_labelbar") procedure add_labelbar(wks,plot,cmap,labels,stride,title,location) local nboxes, nlabel, vph, vpw, lbres, lbid, amres, annoid begin nlabel = dimsizes(labels) nboxes = dimsizes(labels)+1 colors = span_color_rgba(cmap,nboxes) getvalues plot ; Get plot size for use in "vpHeightF" : vph ; creating labelbar. "vpWidthF" : vpw end getvalues ; ; Set some resources for a vertical or horizontal labelbar on the ; bottom or right axis. ; ; am_para/am_orth ; 0.0/ 0.0 - annotation in dead center of plot ; 0.5/ 0.5 - annotation at bottom right of plot ; 0.5/-0.5 - annotation at top right of plot ; -0.5/-0.5 - annotation at top left of plot ; -0.5/ 0.5 - annotation at bottom left of plot ; ; You will likely need to modify the am_para/am_orth ; values depending on your X and Y axis labels, the size ; of your plot, the number of rows and columns you have, et. ; if(any(location.eq.(/"bot1","bot2"/))) then orient = "horizontal" width = vpw * 0.95 ; slightly shorter than width of plot height = vph * 0.15 am_just = "BottomCenter" am_para = 0.0 ; Centered about X axis title_pos = "Top" if(location.eq."bot1") am_orth = 0.85 ; Move labelbar down else am_orth = 1.04 ; Move further down end if else orient = "vertical" width = vpw * 0.15 height = vph * 0.95 ; Slightly shorter than height of plot am_just = "TopLeft" am_orth = -0.5 ; Move labelbar up title_pos = "Left" if(location.eq."rgt2") am_para = 0.55 ; Move labelbar right else am_para = 0.78 ; Move further right end if end if ; labelbar resources lbres = True lbres at lbAutoManage = False ; Necessary to control sizes lbres at vpWidthF = width lbres at vpHeightF = height lbres at lbFillColors = colors ; Labelbar colors lbres at lbMonoFillPattern = True ; Solid fill pattern lbres at lbLabelFontHeightF = 0.015 ; Font height, default is small ; lbres at lbLabelAlignment = "InternalEdges" lbres at lbOrientation = orient lbres at lbTitleString = title lbres at lbPerimOn = False lbres at lbTitlePosition = title_pos lbres at lbLabelStride = stride ; this part is to exclude the boxes outside the range of labels (adapted from https://www.ncl.ucar.edu/Applications/Scripts/lb_14.ncl) lbres at lbLabelAlignment = "ExternalEdges" labels_plus = new(nlabel+2,typeof(labels),labels at _FillValue) labels_plus(1:nlabel) = labels labels_plus(0) = labels(0) labels_plus(nlabel+1) = labels(nlabel-1) lbres at lbLabelStrings = sprintf("%5.1f",labels_plus) lbid = gsn_create_labelbar(wks,nboxes,labels_plus,lbres) ; annotation resources amres = True amres at amJust = am_just amres at amOrthogonalPosF = am_orth amres at amParallelPosF = am_para ; attach the labelbar to the plot plot at annoid = gsn_add_annotation(plot,lbid,amres) end ------ Messaggio Originale ------ Da: asphilli at ucar.edu A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: marted? 4 ottobre 2022 17:53 Oggetto: Re: [ncl-talk] ExcludeOuterBoxes in gsn_create_labelbar Hi Giorgio, You can try setting lbLabelAlignment to "ExternalEdges" which I believe will produce the same results as cnLabelBarEndStyle. See example #14 here: https://www.ncl.ucar.edu/Applications/labelbar.shtml#ex14 Or see many other examples where this resource is set: https://www.ncl.ucar.edu/Applications/res_list.shtml#lbLabelAlignment Hope that helps! Adam On Wed, Sep 28, 2022 at 1:22 PM Giorgio Graffino via ncl-talk > wrote: Dear NCL Community, I'm trying to set the resource cnLabelBarEndStyle to "ExcludeOuterBoxes" while calling gsn_create_labelbar, to get ride of the labelbar boxes bigger than 1 and smaller than -1 in the attached plot. However, since I'm not drawing a contour plot, the resource doesn't do anything. I'm adapting this example (https://www.ncl.ucar.edu/Applications/Scripts/table_8.ncl ). The procedure drawing the labelbar is shown below. How can I solve the issue? I tried to look for a solution in the quick search bar in https://www.ncl.ucar.edu/Support/posting_guidelines.shtml , but it's always giving me the following error "The requested page could not be found." Cheers, Giorgio undef("add_labelbar") procedure add_labelbar(wks,plot,cmap,labels,stride,title,location) local nboxes, vph, vpw, nboxes, lbres, lbid, amres, annoid begin nboxes = dimsizes(labels)+1 colors = span_color_rgba(cmap,nboxes) getvalues plot ; Get plot size for use in "vpHeightF" : vph ; creating labelbar. "vpWidthF" : vpw end getvalues ; ; Set some resources for a vertical or horizontal labelbar on the ; bottom or right axis. ; ; am_para/am_orth ; 0.0/ 0.0 - annotation in dead center of plot ; 0.5/ 0.5 - annotation at bottom right of plot ; 0.5/-0.5 - annotation at top right of plot ; -0.5/-0.5 - annotation at top left of plot ; -0.5/ 0.5 - annotation at bottom left of plot ; ; You will likely need to modify the am_para/am_orth ; values depending on your X and Y axis labels, the size ; of your plot, the number of rows and columns you have, et. ; if(any(location.eq.(/"bot1","bot2"/))) then orient = "horizontal" width = vpw * 0.95 ; slightly shorter than width of plot height = vph * 0.15 am_just = "BottomCenter" am_para = 0.0 ; Centered about X axis title_pos = "Top" if(location.eq."bot1") am_orth = 0.85 ; Move labelbar down else am_orth = 1.04 ; move further down end if else orient = "vertical" width = vpw * 0.15 height = vph * 0.95 ; slightly shorter than height of plot am_just = "TopLeft" am_orth = -0.5 ; Move labelbar up title_pos = "Left" if(location.eq."rgt2") am_para = 0.55 ; Move labelbar right else am_para = 0.78 ; move further right end if end if ; labelbar resources lbres = True lbres at lbAutoManage = False ; Necessary to control sizes lbres at vpWidthF = width lbres at vpHeightF = height lbres at cnLabelBarEndStyle = "ExcludeOuterBoxes" lbres at lbFillColors = colors ; labelbar colors lbres at lbMonoFillPattern = True ; Solid fill pattern lbres at lbLabelFontHeightF = 0.015 ; font height. Default is small lbres at lbLabelAlignment = "InteriorEdges" lbres at lbOrientation = orient lbres at lbTitleString = title lbres at lbPerimOn = False lbres at lbTitlePosition = title_pos lbres at lbLabelStride = stride lbid = gsn_create_labelbar(wks,nboxes,labels,lbres) ; annotation resources amres = True amres at amJust = am_just amres at amOrthogonalPosF = am_orth amres at amParallelPosF = am_para ; attach the labelbar to the plot plot at annoid = gsn_add_annotation(plot,lbid,amres) end_______________________________________________ ncl-talk mailing list ncl-talk at mailman.ucar.edu List instructions, subscriber options, unsubscribe: https://mailman.ucar.edu/mailman/listinfo/ncl-talk -- Adam Phillips Associate Scientist IV, Climate Analysis Section Climate and Global Dynamics Laboratory National Center for Atmospheric Research www.cgd.ucar.edu/staff/asphilli/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From setareh.rahimi at gmail.com Wed Oct 5 09:29:45 2022 From: setareh.rahimi at gmail.com (Setareh Rahimi) Date: Wed, 5 Oct 2022 18:59:45 +0330 Subject: [ncl-talk] How to define date for WRF-chem to get average daily of a variable ? Message-ID: Dear NCL users, I am trying to plot the daily average of AOD (aerosol optical depth) from WRF-chem outputs. However, I can not define the time so that NCL plots the daily average of AOD.(the script has been attached, and the model output is too large and I just used ncdump to show the header of some varibles ). I tried the following commands: times = wrf_user_getvar(f,"times",-1) printVarSummary(times) print(times) ymdh = cd_calendar(a2×, -2) print(ymdh) but faced an error. Would you please kindly advise me on how can I calculate the daily average of AOD from the hourly output of WRF-chem? Many thanks in advance, Best wishes, -- S.Rahimi -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- ;************************************************* ; WRF: DUST_5 ;************************************************ load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" begin f = addfile ("wrfout_d01_2011-07-01_00/00/12", "r") wks = gsn_open_wks("pdf" ,"WRF_aod") ; ps,pdf,x11,ncgm,eps gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; select color map res = True ; plot mods desired res at cnConstFEnableFill = True res at gsnMaximize = True res at gsnSpreadColors = True res at cnFillOn = True res at cnLinesOn = False res at cnLineLabelsOn = False WRF_map_c(f, res, 0) res at tfDoNDCOverlay = True res at pmTickMarkDisplayMode = "Always" opt_sd = True opt_sd at PrintStat = True stat_x = stat_dispersion(x1, opt_sd ) print("-----") a2 = f->TAUAER2 aDay = calculate_daily_values (a2, "avg", 0, opt) printVarSummary(aDay) printMinMax (aDay,1) b3 = f->TAUAER3 bDay = calculate_daily_values (b3, "avg", 0, opt) printVarSummary(bDay) printMinMax (bDay,1) ;---------------------------------------------------------------------- times = wrf_user_getvar(f,"times",-1) printVarSummary(times) print(times) ntimes = dimsizes(times) ymdh = cd_calendar(a2×, -2) print(ymdh) ;----------------------------------------------------------------------- angstrom_exponent = -(log(aDay)-log(bDay))/log(400/600) printVarSummary(angstrom_exponent) AOD550_3D = aDay * ((400/550)^angstrom_exponent) printVarSummary(AOD550_3D) AOD550_2D = dim_sum_n_Wrap(AOD550_3D,0) if (any(isnan_ieee(AOD550_2D))) then value = 9.96921e+36 replace_ieeenan (AOD550_2D,value,0) AOD550_2D at _FillValue = value end if printVarSummary(AOD550_2D) printMinMax (AOD550_2D,1) res at tiMainString = "WRF-CHEM (aod_550) " + times(nt) res at gsnLeftString = a2 at description plot = gsn_csm_contour_map(wks,AOD550_2D(:,:),res) end -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 1401-07-13 at 6.56.43 PM.png Type: image/png Size: 162605 bytes Desc: not available URL: From zmumba at gmail.com Thu Oct 6 14:03:52 2022 From: zmumba at gmail.com (Zilore Mumba) Date: Thu, 6 Oct 2022 22:03:52 +0200 Subject: [ncl-talk] WRF streamlines in ncl Message-ID: I am wondering if there is anybody drawing streamlines with WRF output. My search has yielded nothing and my attempt has been disastrous. I am having two problems: 1. how do I attach lon/lat units to the u, v components (check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all... errors). See code pasted below. 2. The streamlines are drawn, but in the wrong place over a global map. If there is anyone who is able to draw streamlines, I will appreciate to learn from them. my doe so far, below load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin ; ; Read in data. ;;;;;;;;;;;;;; ; f = addfile("/home/zmumba/DA/OUTPUT/2022092800/noda/wrfout_d01_2022-09-28_00:00: 00.nc","r") ; What times and how many time steps are in the data set? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; times = wrf_user_getvar(f,"times",-1) ; get all times in the file ntimes = dimsizes(times) ; number of times in the file ; The specific pressure levels that we want the data interpolated to. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; pressure_levels = (/ 850., 700., 500., 300./) ; pressure levels to plot nlevels = dimsizes(pressure_levels) ; number of pressure levels tc = wrf_user_getvar(f,"tc",-1) ; T in C u = wrf_user_getvar(f,"ua",-1) ; u averaged to mass points v = wrf_user_getvar(f,"va",-1) ; v averaged to mass points p = wrf_user_getvar(f, "pressure",-1) ; pressure is our vertical coordinate z = wrf_user_getvar(f, "z",-1) ; grid point height rh = wrf_user_getvar(f,"rh",-1) ; relative humidity ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;lat2d = wrf_user_getvar(f,"XLAT",0) ;lon2d = wrf_user_getvar(f,"XLONG",0) lat2d = f->XLAT(0,:,:) lon2d = f->XLONG(0,:,:) lat = lat2d(:,0) ; create classic 1D coordinate arrays lon = lon2d(0,:) ;u&lat at units = "degrees_north" ;u&lon at units = "degrees_east" ;v&lat at units = "degrees_north" ;v&lon at units = "degrees_east" ;lat at units= "degrees_north" ;lon at units= "degrees_east" ;lat!0 = "lat" ;lon!0 = "lon" ;lat&lat = lat ;lon&lon = lon ;pressure = pressure_levels(level) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; pressure = pressure_levels(0) tc_plane = wrf_user_intrp3d(tc,p,"h",pressure,0.,False) z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False) rh_plane = wrf_user_intrp3d(rh,p,"h",pressure,0.,False) u_plane = wrf_user_intrp3d( u,p,"h",pressure,0.,False) v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False) spd = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec spd at description = "Wind Speed" spd at units = "m/s" u_plane = u_plane*1.94386 ; kts v_plane = v_plane*1.94386 ; kts u_plane at units = "kts" v_plane at units = "kts" wks = gsn_open_wks("x11","gsn_csm_streamline_map") res = True res at gsnAddCyclic = False res at gsnMaximize = True res at gsnDraw = False ; don't draw yet res at gsnFrame = False ; don't advance yet res at tiMainString = "WRF Streamlines" ; draw a title res at gsnLeftString = "" res at gsnRightString = "" res at gsnCenterString = " " res at mpProjection = "Mercator" ;---Zoom in on map and plot again ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;res at cnLineThicknessF = 2 ; make lines thicker, Default: 1 ;res at mpMinLatF = min(lat) ; zoom in on lat/lon area ;res at mpMaxLatF = max(lat) ;res at mpMinLonF = min(lon) ;res at mpMaxLonF = max(lon) res at mpDataBaseVersion = "MediumRes" ; better and more map outlines res at mpDataSetName = "Earth..4" res at mpOutlineBoundarySets = "AllBoundaries" res at mpOutlineOn = True res at mpNationalLineThicknessF = 2.5 ; turn on country boundaries res at lbOrientation = "Vertical" res at tiMainOffsetYF = -0.03 ; Move the title down plot = gsn_csm_streamline_map(wks,u_plane,v_plane,res) ;Define shapefiles ;***************** shp_filename = ("$HOME/DA/SCRIPTS/06_Utility_Files/Shapefiles/Lesotho/lso_admbnda_adm1_FAO_MLGCA_2019.shp") ;Set shapefile resources ;*********************** shpres = True shpres at gsLineThicknessF = 1 ; increase line thickness shpres at gsLineColor = "Black" ; line colorgsLineThicknessF shpres at gsLineDashPattern = 1 shp= gsn_add_shapefile_polylines(wks,plot,shp_filename,shpres) draw(plot) frame(wks) end -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Thu Oct 6 16:06:18 2022 From: shea at ucar.edu (Dennis Shea) Date: Thu, 6 Oct 2022 16:06:18 -0600 Subject: [ncl-talk] WRF streamlines in ncl In-Reply-To: References: Message-ID: 1] NCL calculates streamlines ONLY for global rectilinear grids using spherical harmonics. * https://www.ncl.ucar.edu/Applications/stream.shtml* NCL does not provide any functions for creating streamlines for WRF winds, which, I believe, are on a curvilinear staggered grid. I am not aware of WRF streamlines being plotted in *ANY* language (Matlab, Python, IDL, GrADS, ferret, ...). [2] Perhaps, a WRF post-processing group could help. [3] Generally, speaking, the following is not correct: lat2d = f->XLAT(0,:,:) lon2d = f->XLONG(0,:,:) lat = lat2d(:,0) ; create classic 1D coordinate arrays lon = lon2d(0,:) [4] **IF IT WAS CORTRECT**, you would have to do lat at units= "degrees_north" lon at units= "degrees_east" lat!0 = "lat" lon!0 = "lon" lat&lat = lat lon&lon = lon [5] Hypothetically, if the grid was {u,v}_plane was 2-dimensional u_plane!0 = "lat" u_plane!1 = "lon" u_plane&lat = lat u_plane&lon = lon printVarSummary(uplane) same for v_plane [5] plot = gsn_csm_streamline_map(wks,u_plane,v_plane,res) On Thu, Oct 6, 2022 at 2:04 PM Zilore Mumba via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > > I am wondering if there is anybody drawing streamlines with WRF output. My > search has yielded nothing and my attempt has been disastrous. > I am having two problems: > 1. how do I attach lon/lat units to the u, v components > (check_for_y_lat_coord: Warning: Data either does not contain > a valid latitude coordinate array or doesn't contain one at all... errors). > See code pasted below. > 2. The streamlines are drawn, but in the wrong place over a global map. > If there is anyone who is able to draw streamlines, I will appreciate to > learn from them. > > my doe so far, below > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" > > begin > ; > ; Read in data. > ;;;;;;;;;;;;;; > ; > f = > addfile("/home/zmumba/DA/OUTPUT/2022092800/noda/wrfout_d01_2022-09-28_00:00: > 00.nc","r") > > ; What times and how many time steps are in the data set? > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > times = wrf_user_getvar(f,"times",-1) ; get all times in the file > ntimes = dimsizes(times) ; number of times in the file > > ; The specific pressure levels that we want the data interpolated to. > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > pressure_levels = (/ 850., 700., 500., 300./) ; pressure levels to > plot > nlevels = dimsizes(pressure_levels) ; number of pressure > levels > > > tc = wrf_user_getvar(f,"tc",-1) ; T in C > u = wrf_user_getvar(f,"ua",-1) ; u averaged to mass points > v = wrf_user_getvar(f,"va",-1) ; v averaged to mass points > p = wrf_user_getvar(f, "pressure",-1) ; pressure is our vertical > coordinate > z = wrf_user_getvar(f, "z",-1) ; grid point height > rh = wrf_user_getvar(f,"rh",-1) ; relative humidity > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > ;lat2d = wrf_user_getvar(f,"XLAT",0) > ;lon2d = wrf_user_getvar(f,"XLONG",0) > > lat2d = f->XLAT(0,:,:) > lon2d = f->XLONG(0,:,:) > > lat = lat2d(:,0) ; create classic 1D coordinate arrays > lon = lon2d(0,:) > > ;u&lat at units = "degrees_north" > ;u&lon at units = "degrees_east" > ;v&lat at units = "degrees_north" > ;v&lon at units = "degrees_east" > > ;lat at units= "degrees_north" > ;lon at units= "degrees_east" > ;lat!0 = "lat" > ;lon!0 = "lon" > ;lat&lat = lat > ;lon&lon = lon > > > ;pressure = pressure_levels(level) > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > pressure = pressure_levels(0) > > tc_plane = wrf_user_intrp3d(tc,p,"h",pressure,0.,False) > z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False) > rh_plane = wrf_user_intrp3d(rh,p,"h",pressure,0.,False) > u_plane = wrf_user_intrp3d( u,p,"h",pressure,0.,False) > v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False) > > spd = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec > spd at description = "Wind Speed" > spd at units = "m/s" > u_plane = u_plane*1.94386 ; kts > v_plane = v_plane*1.94386 ; kts > u_plane at units = "kts" > v_plane at units = "kts" > > wks = gsn_open_wks("x11","gsn_csm_streamline_map") > > res = True > res at gsnAddCyclic = False > res at gsnMaximize = True > res at gsnDraw = False ; don't draw yet > res at gsnFrame = False ; don't advance yet > > res at tiMainString = "WRF Streamlines" ; draw a title > res at gsnLeftString = "" > res at gsnRightString = "" > res at gsnCenterString = " " > > res at mpProjection = "Mercator" > > ;---Zoom in on map and plot again > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;res at cnLineThicknessF = 2 ; make lines thicker, Default: 1 > ;res at mpMinLatF = min(lat) ; zoom in on lat/lon area > ;res at mpMaxLatF = max(lat) > ;res at mpMinLonF = min(lon) > ;res at mpMaxLonF = max(lon) > > res at mpDataBaseVersion = "MediumRes" ; better and more map > outlines > res at mpDataSetName = "Earth..4" > res at mpOutlineBoundarySets = "AllBoundaries" > res at mpOutlineOn = True > res at mpNationalLineThicknessF = 2.5 ; turn on country > boundaries > > res at lbOrientation = "Vertical" > res at tiMainOffsetYF = -0.03 ; Move the title down > > plot = gsn_csm_streamline_map(wks,u_plane,v_plane,res) > > ;Define shapefiles > ;***************** > shp_filename = > ("$HOME/DA/SCRIPTS/06_Utility_Files/Shapefiles/Lesotho/lso_admbnda_adm1_FAO_MLGCA_2019.shp") > > ;Set shapefile resources > ;*********************** > shpres = True > shpres at gsLineThicknessF = 1 ; increase line thickness > shpres at gsLineColor = "Black" ; line > colorgsLineThicknessF > shpres at gsLineDashPattern = 1 > > shp= gsn_add_shapefile_polylines(wks,plot,shp_filename,shpres) > > draw(plot) > frame(wks) > end > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.kren at noaa.gov Thu Oct 6 19:49:57 2022 From: andrew.kren at noaa.gov (Andrew Kren - NOAA Federal) Date: Thu, 6 Oct 2022 21:49:57 -0400 Subject: [ncl-talk] Question on blending two datasets for merged analysis Message-ID: Hi there, This question may not have an answer. I have not been able to find an answer online so I thought I would ask. I have an irregular set of data of 1D lat/lon data of some variable, call it precipitation observations from metar sites. I regrid this data using ESMF onto a 0.1 degree grid as similar in NCL examples. This works fine, but at the edges, as expected, there is no data so the contour plot is sharp/jagged (see attached figure). I would like to merge this regridded data with an observational precipitation dataset, call it grib files of AHPS precipitation, over a similar period. My question is, is there a way to merge these two datasets to get a blended analysis so that the resulting contour analysis is smooth and defined in all counties? Thanks, -- Andrew Kren Meteorologist NOAA's National Weather Service Raleigh Forecast Office 1005 Capability Drive, Suite 300 Raleigh, North Carolina 27606 voice: 919-326-1035 mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.png Type: image/png Size: 218590 bytes Desc: not available URL: From shea at ucar.edu Thu Oct 6 20:32:29 2022 From: shea at ucar.edu (Dennis Shea) Date: Thu, 6 Oct 2022 20:32:29 -0600 Subject: [ncl-talk] How to define date for WRF-chem to get average daily of a variable ? In-Reply-To: References: Message-ID: As noted in the documentation, *calculate_daily_values* requires that the variable have a **time coordinate** that is recognized by cd_calendar. Times = f->Times ; Times(Time, DateStrLen) (type character) Time = *wrf_times_c*( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar a2 = f->TAUAER ; (Time, south_north, west_east) a2&Time = Time ; associate the 'Time' coordinate with the variable using standard NCL & syntax printVarSummary(a2) print("------------------------------------") a2Day = calculate_daily_values (a2, "avg", 0, opt) printVarSummary(a2Day) printMinMax (a2Day,1) On Wed, Oct 5, 2022 at 9:30 AM Setareh Rahimi via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Dear NCL users, > > I am trying to plot the daily average of AOD (aerosol optical depth) from > WRF-chem outputs. However, I can not define the time so that NCL plots the > daily average of AOD.(the script has been attached, and the model output is > too large and I just used ncdump to show the header of some varibles ). > I tried the following commands: > > > times = wrf_user_getvar(f,"times",-1) > printVarSummary(times) > print(times) > ymdh = cd_calendar(a2×, -2) > print(ymdh) > > but faced an error. > Would you please kindly advise me on how can I calculate the daily average > of AOD from the hourly output of WRF-chem? > Many thanks in advance, > Best wishes, > -- > S.Rahimi > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Thu Oct 6 20:39:01 2022 From: shea at ucar.edu (Dennis Shea) Date: Thu, 6 Oct 2022 20:39:01 -0600 Subject: [ncl-talk] Question on blending two datasets for merged analysis In-Reply-To: References: Message-ID: I am not sure how one would "merge this regridded data with an observational precipitation dataset, call it grib files of AHPS precipitation, over a similar period. " Perhaps, append GRIB AHPS precipitation grid points at areas outside the max/min boundaries of the "irregular set of data of 1D lat/lon data" Good luck On Thu, Oct 6, 2022 at 7:50 PM Andrew Kren - NOAA Federal via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi there, > > This question may not have an answer. I have not been able to find an > answer online so I thought I would ask. > > I have an irregular set of data of 1D lat/lon data of some variable, call > it precipitation observations from metar sites. I regrid this data using > ESMF onto a 0.1 degree grid as similar in NCL examples. This works fine, > but at the edges, as expected, there is no data so the contour plot is > sharp/jagged (see attached figure). I would like to merge this regridded > data with an observational precipitation dataset, call it grib files of > AHPS precipitation, over a similar period. > > My question is, is there a way to merge these two datasets to get a > blended analysis so that the resulting contour analysis is smooth and > defined in all counties? > > Thanks, > > -- > > Andrew Kren > Meteorologist > NOAA's National Weather Service > Raleigh Forecast Office > 1005 Capability Drive, Suite 300 > Raleigh, North Carolina 27606 > voice: 919-326-1035 > mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zmumba at gmail.com Thu Oct 6 23:29:44 2022 From: zmumba at gmail.com (Zilore Mumba) Date: Fri, 7 Oct 2022 07:29:44 +0200 Subject: [ncl-talk] WRF streamlines in ncl In-Reply-To: References: Message-ID: Thanks Rick, I will try that example. On Thu, Oct 6, 2022 at 10:37 PM Rick Brownrigg wrote: > Hi Zilore, > > There's a WRF examples page that's a bit obscurely referenced from the > main examples pages: > > http://ncl.ucar.edu/Applications/wrfgsn.shtml#ex8 > > Example #8 in particular shows how to set up the coordinates. I am not an > expert at this, but hopefully there's enough there to get you going. > > Rick > > > On Thu, Oct 6, 2022 at 2:04 PM Zilore Mumba via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> >> I am wondering if there is anybody drawing streamlines with WRF output. >> My search has yielded nothing and my attempt has been disastrous. >> I am having two problems: >> 1. how do I attach lon/lat units to the u, v components >> (check_for_y_lat_coord: Warning: Data either does not contain >> a valid latitude coordinate array or doesn't contain one at all... >> errors). >> See code pasted below. >> 2. The streamlines are drawn, but in the wrong place over a global map. >> If there is anyone who is able to draw streamlines, I will appreciate to >> learn from them. >> >> my doe so far, below >> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" >> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" >> >> begin >> ; >> ; Read in data. >> ;;;;;;;;;;;;;; >> ; >> f = >> addfile("/home/zmumba/DA/OUTPUT/2022092800/noda/wrfout_d01_2022-09-28_00:00: >> 00.nc","r") >> >> ; What times and how many time steps are in the data set? >> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >> times = wrf_user_getvar(f,"times",-1) ; get all times in the file >> ntimes = dimsizes(times) ; number of times in the file >> >> ; The specific pressure levels that we want the data interpolated to. >> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >> pressure_levels = (/ 850., 700., 500., 300./) ; pressure levels to >> plot >> nlevels = dimsizes(pressure_levels) ; number of pressure >> levels >> >> >> tc = wrf_user_getvar(f,"tc",-1) ; T in C >> u = wrf_user_getvar(f,"ua",-1) ; u averaged to mass points >> v = wrf_user_getvar(f,"va",-1) ; v averaged to mass points >> p = wrf_user_getvar(f, "pressure",-1) ; pressure is our vertical >> coordinate >> z = wrf_user_getvar(f, "z",-1) ; grid point height >> rh = wrf_user_getvar(f,"rh",-1) ; relative humidity >> >> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >> >> ;lat2d = wrf_user_getvar(f,"XLAT",0) >> ;lon2d = wrf_user_getvar(f,"XLONG",0) >> >> lat2d = f->XLAT(0,:,:) >> lon2d = f->XLONG(0,:,:) >> >> lat = lat2d(:,0) ; create classic 1D coordinate arrays >> lon = lon2d(0,:) >> >> ;u&lat at units = "degrees_north" >> ;u&lon at units = "degrees_east" >> ;v&lat at units = "degrees_north" >> ;v&lon at units = "degrees_east" >> >> ;lat at units= "degrees_north" >> ;lon at units= "degrees_east" >> ;lat!0 = "lat" >> ;lon!0 = "lon" >> ;lat&lat = lat >> ;lon&lon = lon >> >> >> ;pressure = pressure_levels(level) >> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >> pressure = pressure_levels(0) >> >> tc_plane = wrf_user_intrp3d(tc,p,"h",pressure,0.,False) >> z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False) >> rh_plane = wrf_user_intrp3d(rh,p,"h",pressure,0.,False) >> u_plane = wrf_user_intrp3d( u,p,"h",pressure,0.,False) >> v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False) >> >> spd = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec >> spd at description = "Wind Speed" >> spd at units = "m/s" >> u_plane = u_plane*1.94386 ; kts >> v_plane = v_plane*1.94386 ; kts >> u_plane at units = "kts" >> v_plane at units = "kts" >> >> wks = gsn_open_wks("x11","gsn_csm_streamline_map") >> >> res = True >> res at gsnAddCyclic = False >> res at gsnMaximize = True >> res at gsnDraw = False ; don't draw yet >> res at gsnFrame = False ; don't advance yet >> >> res at tiMainString = "WRF Streamlines" ; draw a title >> res at gsnLeftString = "" >> res at gsnRightString = "" >> res at gsnCenterString = " " >> >> res at mpProjection = "Mercator" >> >> ;---Zoom in on map and plot again >> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >> ;res at cnLineThicknessF = 2 ; make lines thicker, Default: >> 1 >> ;res at mpMinLatF = min(lat) ; zoom in on lat/lon area >> ;res at mpMaxLatF = max(lat) >> ;res at mpMinLonF = min(lon) >> ;res at mpMaxLonF = max(lon) >> >> res at mpDataBaseVersion = "MediumRes" ; better and more map >> outlines >> res at mpDataSetName = "Earth..4" >> res at mpOutlineBoundarySets = "AllBoundaries" >> res at mpOutlineOn = True >> res at mpNationalLineThicknessF = 2.5 ; turn on country >> boundaries >> >> res at lbOrientation = "Vertical" >> res at tiMainOffsetYF = -0.03 ; Move the title down >> >> plot = gsn_csm_streamline_map(wks,u_plane,v_plane,res) >> >> ;Define shapefiles >> ;***************** >> shp_filename = >> ("$HOME/DA/SCRIPTS/06_Utility_Files/Shapefiles/Lesotho/lso_admbnda_adm1_FAO_MLGCA_2019.shp") >> >> ;Set shapefile resources >> ;*********************** >> shpres = True >> shpres at gsLineThicknessF = 1 ; increase line thickness >> shpres at gsLineColor = "Black" ; line >> colorgsLineThicknessF >> shpres at gsLineDashPattern = 1 >> >> shp= gsn_add_shapefile_polylines(wks,plot,shp_filename,shpres) >> >> draw(plot) >> frame(wks) >> end >> _______________________________________________ >> ncl-talk mailing list >> ncl-talk at mailman.ucar.edu >> List instructions, subscriber options, unsubscribe: >> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zmumba at gmail.com Fri Oct 7 02:01:27 2022 From: zmumba at gmail.com (Zilore Mumba) Date: Fri, 7 Oct 2022 10:01:27 +0200 Subject: [ncl-talk] WRF streamlines in ncl In-Reply-To: References: Message-ID: Rick, Thank you once again. wrf_gsn_8.ncl does exactly what I was trying to do. I do not know how I missed it. I spent the whole of Thursday 6th Oct. trying to make my code work. best regards. On Fri, Oct 7, 2022 at 7:29 AM Zilore Mumba wrote: > Thanks Rick, I will try that example. > > On Thu, Oct 6, 2022 at 10:37 PM Rick Brownrigg wrote: > >> Hi Zilore, >> >> There's a WRF examples page that's a bit obscurely referenced from the >> main examples pages: >> >> http://ncl.ucar.edu/Applications/wrfgsn.shtml#ex8 >> >> Example #8 in particular shows how to set up the coordinates. I am not an >> expert at this, but hopefully there's enough there to get you going. >> >> Rick >> >> >> On Thu, Oct 6, 2022 at 2:04 PM Zilore Mumba via ncl-talk < >> ncl-talk at mailman.ucar.edu> wrote: >> >>> >>> I am wondering if there is anybody drawing streamlines with WRF output. >>> My search has yielded nothing and my attempt has been disastrous. >>> I am having two problems: >>> 1. how do I attach lon/lat units to the u, v components >>> (check_for_y_lat_coord: Warning: Data either does not contain >>> a valid latitude coordinate array or doesn't contain one at all... >>> errors). >>> See code pasted below. >>> 2. The streamlines are drawn, but in the wrong place over a global map. >>> If there is anyone who is able to draw streamlines, I will appreciate to >>> learn from them. >>> >>> my doe so far, below >>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" >>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" >>> >>> begin >>> ; >>> ; Read in data. >>> ;;;;;;;;;;;;;; >>> ; >>> f = >>> addfile("/home/zmumba/DA/OUTPUT/2022092800/noda/wrfout_d01_2022-09-28_00:00: >>> 00.nc","r") >>> >>> ; What times and how many time steps are in the data set? >>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >>> times = wrf_user_getvar(f,"times",-1) ; get all times in the file >>> ntimes = dimsizes(times) ; number of times in the file >>> >>> ; The specific pressure levels that we want the data interpolated to. >>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >>> pressure_levels = (/ 850., 700., 500., 300./) ; pressure levels to >>> plot >>> nlevels = dimsizes(pressure_levels) ; number of pressure >>> levels >>> >>> >>> tc = wrf_user_getvar(f,"tc",-1) ; T in C >>> u = wrf_user_getvar(f,"ua",-1) ; u averaged to mass points >>> v = wrf_user_getvar(f,"va",-1) ; v averaged to mass points >>> p = wrf_user_getvar(f, "pressure",-1) ; pressure is our vertical >>> coordinate >>> z = wrf_user_getvar(f, "z",-1) ; grid point height >>> rh = wrf_user_getvar(f,"rh",-1) ; relative humidity >>> >>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >>> >>> ;lat2d = wrf_user_getvar(f,"XLAT",0) >>> ;lon2d = wrf_user_getvar(f,"XLONG",0) >>> >>> lat2d = f->XLAT(0,:,:) >>> lon2d = f->XLONG(0,:,:) >>> >>> lat = lat2d(:,0) ; create classic 1D coordinate >>> arrays >>> lon = lon2d(0,:) >>> >>> ;u&lat at units = "degrees_north" >>> ;u&lon at units = "degrees_east" >>> ;v&lat at units = "degrees_north" >>> ;v&lon at units = "degrees_east" >>> >>> ;lat at units= "degrees_north" >>> ;lon at units= "degrees_east" >>> ;lat!0 = "lat" >>> ;lon!0 = "lon" >>> ;lat&lat = lat >>> ;lon&lon = lon >>> >>> >>> ;pressure = pressure_levels(level) >>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >>> pressure = pressure_levels(0) >>> >>> tc_plane = wrf_user_intrp3d(tc,p,"h",pressure,0.,False) >>> z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False) >>> rh_plane = wrf_user_intrp3d(rh,p,"h",pressure,0.,False) >>> u_plane = wrf_user_intrp3d( u,p,"h",pressure,0.,False) >>> v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False) >>> >>> spd = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec >>> spd at description = "Wind Speed" >>> spd at units = "m/s" >>> u_plane = u_plane*1.94386 ; kts >>> v_plane = v_plane*1.94386 ; kts >>> u_plane at units = "kts" >>> v_plane at units = "kts" >>> >>> wks = gsn_open_wks("x11","gsn_csm_streamline_map") >>> >>> res = True >>> res at gsnAddCyclic = False >>> res at gsnMaximize = True >>> res at gsnDraw = False ; don't draw yet >>> res at gsnFrame = False ; don't advance yet >>> >>> res at tiMainString = "WRF Streamlines" ; draw a title >>> res at gsnLeftString = "" >>> res at gsnRightString = "" >>> res at gsnCenterString = " " >>> >>> res at mpProjection = "Mercator" >>> >>> ;---Zoom in on map and plot again >>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >>> ;res at cnLineThicknessF = 2 ; make lines thicker, >>> Default: 1 >>> ;res at mpMinLatF = min(lat) ; zoom in on lat/lon area >>> ;res at mpMaxLatF = max(lat) >>> ;res at mpMinLonF = min(lon) >>> ;res at mpMaxLonF = max(lon) >>> >>> res at mpDataBaseVersion = "MediumRes" ; better and more >>> map outlines >>> res at mpDataSetName = "Earth..4" >>> res at mpOutlineBoundarySets = "AllBoundaries" >>> res at mpOutlineOn = True >>> res at mpNationalLineThicknessF = 2.5 ; turn on country >>> boundaries >>> >>> res at lbOrientation = "Vertical" >>> res at tiMainOffsetYF = -0.03 ; Move the title down >>> >>> plot = gsn_csm_streamline_map(wks,u_plane,v_plane,res) >>> >>> ;Define shapefiles >>> ;***************** >>> shp_filename = >>> ("$HOME/DA/SCRIPTS/06_Utility_Files/Shapefiles/Lesotho/lso_admbnda_adm1_FAO_MLGCA_2019.shp") >>> >>> ;Set shapefile resources >>> ;*********************** >>> shpres = True >>> shpres at gsLineThicknessF = 1 ; increase line >>> thickness >>> shpres at gsLineColor = "Black" ; line >>> colorgsLineThicknessF >>> shpres at gsLineDashPattern = 1 >>> >>> shp= gsn_add_shapefile_polylines(wks,plot,shp_filename,shpres) >>> >>> draw(plot) >>> frame(wks) >>> end >>> _______________________________________________ >>> ncl-talk mailing list >>> ncl-talk at mailman.ucar.edu >>> List instructions, subscriber options, unsubscribe: >>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From setareh.rahimi at gmail.com Fri Oct 7 05:16:45 2022 From: setareh.rahimi at gmail.com (Setareh Rahimi) Date: Fri, 7 Oct 2022 14:46:45 +0330 Subject: [ncl-talk] How to define date for WRF-chem to get average daily of a variable ? In-Reply-To: References: Message-ID: Dear Dennis, So many thanks for your advice. I made corrections to my script as you suggested, and attempted to calculate and plot the average AOD for 2011-06-28 but I still get errors. I attached the script and the errors. As you can see from the error message, NCL says :fatal: No coordinate variable exists for dimension (Time) in variable (x) I wonder about variable x; I did not define such a variable. Please advise me on how to sort this issue out. Many thanks in advance, Best wishes, On Fri, Oct 7, 2022 at 6:02 AM Dennis Shea wrote: > As noted in the documentation, *calculate_daily_values* > > requires that the variable have a **time coordinate** that is recognized by > cd_calendar. > > Times = f->Times ; Times(Time, DateStrLen) (type character) > Time = *wrf_times_c*( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar > > a2 = f->TAUAER ; (Time, south_north, west_east) > a2&Time = Time ; associate the 'Time' coordinate with the variable > using standard NCL & syntax > printVarSummary(a2) > print("------------------------------------") > > a2Day = calculate_daily_values (a2, "avg", 0, opt) > printVarSummary(a2Day) > printMinMax (a2Day,1) > > > > On Wed, Oct 5, 2022 at 9:30 AM Setareh Rahimi via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Dear NCL users, >> >> I am trying to plot the daily average of AOD (aerosol optical depth) from >> WRF-chem outputs. However, I can not define the time so that NCL plots the >> daily average of AOD.(the script has been attached, and the model output is >> too large and I just used ncdump to show the header of some varibles ). >> I tried the following commands: >> >> >> times = wrf_user_getvar(f,"times",-1) >> printVarSummary(times) >> print(times) >> ymdh = cd_calendar(a2×, -2) >> print(ymdh) >> >> but faced an error. >> Would you please kindly advise me on how can I calculate the daily >> average of AOD from the hourly output of WRF-chem? >> Many thanks in advance, >> Best wishes, >> -- >> S.Rahimi >> >> _______________________________________________ >> ncl-talk mailing list >> ncl-talk at mailman.ucar.edu >> List instructions, subscriber options, unsubscribe: >> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >> > -- S.Rahimi -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: dust-ncl Type: application/octet-stream Size: 2271 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 1401-07-15 at 2.37.10 PM.png Type: image/png Size: 126935 bytes Desc: not available URL: From shea at ucar.edu Fri Oct 7 05:48:44 2022 From: shea at ucar.edu (Dennis Shea) Date: Fri, 7 Oct 2022 05:48:44 -0600 Subject: [ncl-talk] How to define date for WRF-chem to get average daily of a variable ? In-Reply-To: References: Message-ID: I do not understand 'x' either "I wonder about variable x; I did not define such a variable." ncl 0> f = addfile(".....","r") ; I do not have your file ncl 1> print(f) ; like ncdump -h ncl 2> Times = f->Times ; Times(Time, DateStrLen) (type character) ncl 4> Time = wrf_times_c( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar ncl 5> print(Time) ncl 7> T = f->T ncl 8> printVarSummary(T) ncl 9> T&Time = Time ; associate time coordinate ncl 10> printVarSummary(T) Variable: T Type: float Total Size: 19683000 bytes 4920750 values Number of Dimensions: 4 Dimensions and sizes: [Time | ??] x [bottom_top | 27] x [south_north | 81] x [west_east | 90] Coordinates: Time: [ 0.. ?] Number Of Attributes: 5 FieldType : 104 MemoryOrder : XYZ description : perturbation potential temperature (theta-t0) units : K stagger : ncl 11> Tavg = calculate_daily_values (T, "avg", 0, True) ncl 12> printVarSummary(Tavg) Variable: Tavg Type: float Total Size: 1574640 bytes 393660 values Number of Dimensions: 4 Dimensions and sizes: [Time | ...] x [bottom_top | 27] x [south_north | 81] x [west_east | 90] Coordinates: Time: [ 0.. 12] Number Of Attributes: 8 _FillValue : 9.96921e+36 FieldType : 104 MemoryOrder : XYZ description : perturbation potential temperature (theta-t0) units : K stagger : Time : 0 NCL_tag : calculate_daily_values On Fri, Oct 7, 2022 at 5:16 AM Setareh Rahimi wrote: > Dear Dennis, > So many thanks for your advice. I made corrections to my script as you > suggested, and attempted to calculate and plot the average AOD for > 2011-06-28 but I still get errors. I attached the script and the errors. > > As you can see from the error message, NCL says :fatal: No coordinate > variable exists for dimension (Time) in variable (x) > I wonder about variable x; I did not define such a variable. > > Please advise me on how to sort this issue out. > Many thanks in advance, > Best wishes, > > On Fri, Oct 7, 2022 at 6:02 AM Dennis Shea wrote: > >> As noted in the documentation, *calculate_daily_values* >> >> requires that the variable have a **time coordinate** that is recognized by >> cd_calendar. >> >> Times = f->Times ; Times(Time, DateStrLen) (type character) >> Time = *wrf_times_c*( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar >> >> a2 = f->TAUAER ; (Time, south_north, west_east) >> a2&Time = Time ; associate the 'Time' coordinate with the variable >> using standard NCL & syntax >> printVarSummary(a2) >> print("------------------------------------") >> >> a2Day = calculate_daily_values (a2, "avg", 0, opt) >> printVarSummary(a2Day) >> printMinMax (a2Day,1) >> >> >> >> On Wed, Oct 5, 2022 at 9:30 AM Setareh Rahimi via ncl-talk < >> ncl-talk at mailman.ucar.edu> wrote: >> >>> Dear NCL users, >>> >>> I am trying to plot the daily average of AOD (aerosol optical depth) >>> from WRF-chem outputs. However, I can not define the time so that NCL plots >>> the daily average of AOD.(the script has been attached, and the model >>> output is too large and I just used ncdump to show the header of some >>> varibles ). >>> I tried the following commands: >>> >>> >>> times = wrf_user_getvar(f,"times",-1) >>> printVarSummary(times) >>> print(times) >>> ymdh = cd_calendar(a2×, -2) >>> print(ymdh) >>> >>> but faced an error. >>> Would you please kindly advise me on how can I calculate the daily >>> average of AOD from the hourly output of WRF-chem? >>> Many thanks in advance, >>> Best wishes, >>> -- >>> S.Rahimi >>> >>> _______________________________________________ >>> ncl-talk mailing list >>> ncl-talk at mailman.ucar.edu >>> List instructions, subscriber options, unsubscribe: >>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>> >> > > -- > S.Rahimi > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Fri Oct 7 09:15:16 2022 From: shea at ucar.edu (Dennis Shea) Date: Fri, 7 Oct 2022 09:15:16 -0600 Subject: [ncl-talk] WRF streamlines in ncl In-Reply-To: References: Message-ID: Oops. Apologies. I had a 'brain freeze' For some unknown reason, I 'conflated' stream function and streamline. stream function: See Example wind_3.ncl @ * http://ncl.ucar.edu/Applications/wind.shtml* On Fri, Oct 7, 2022 at 2:01 AM Zilore Mumba via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Rick, > Thank you once again. wrf_gsn_8.ncl does exactly what I was trying to do. > I do not know how I missed it. I spent the whole of Thursday 6th Oct. > trying to make my code work. > best regards. > > On Fri, Oct 7, 2022 at 7:29 AM Zilore Mumba wrote: > >> Thanks Rick, I will try that example. >> >> On Thu, Oct 6, 2022 at 10:37 PM Rick Brownrigg wrote: >> >>> Hi Zilore, >>> >>> There's a WRF examples page that's a bit obscurely referenced from the >>> main examples pages: >>> >>> http://ncl.ucar.edu/Applications/wrfgsn.shtml#ex8 >>> >>> Example #8 in particular shows how to set up the coordinates. I am not >>> an expert at this, but hopefully there's enough there to get you going. >>> >>> Rick >>> >>> >>> On Thu, Oct 6, 2022 at 2:04 PM Zilore Mumba via ncl-talk < >>> ncl-talk at mailman.ucar.edu> wrote: >>> >>>> >>>> I am wondering if there is anybody drawing streamlines with WRF output. >>>> My search has yielded nothing and my attempt has been disastrous. >>>> I am having two problems: >>>> 1. how do I attach lon/lat units to the u, v components >>>> (check_for_y_lat_coord: Warning: Data either does not contain >>>> a valid latitude coordinate array or doesn't contain one at all... >>>> errors). >>>> See code pasted below. >>>> 2. The streamlines are drawn, but in the wrong place over a global map. >>>> If there is anyone who is able to draw streamlines, I will appreciate >>>> to learn from them. >>>> >>>> my doe so far, below >>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" >>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" >>>> >>>> begin >>>> ; >>>> ; Read in data. >>>> ;;;;;;;;;;;;;; >>>> ; >>>> f = >>>> addfile("/home/zmumba/DA/OUTPUT/2022092800/noda/wrfout_d01_2022-09-28_00:00: >>>> 00.nc","r") >>>> >>>> ; What times and how many time steps are in the data set? >>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >>>> times = wrf_user_getvar(f,"times",-1) ; get all times in the file >>>> ntimes = dimsizes(times) ; number of times in the file >>>> >>>> ; The specific pressure levels that we want the data interpolated to. >>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >>>> pressure_levels = (/ 850., 700., 500., 300./) ; pressure levels to >>>> plot >>>> nlevels = dimsizes(pressure_levels) ; number of pressure >>>> levels >>>> >>>> >>>> tc = wrf_user_getvar(f,"tc",-1) ; T in C >>>> u = wrf_user_getvar(f,"ua",-1) ; u averaged to mass points >>>> v = wrf_user_getvar(f,"va",-1) ; v averaged to mass points >>>> p = wrf_user_getvar(f, "pressure",-1) ; pressure is our vertical >>>> coordinate >>>> z = wrf_user_getvar(f, "z",-1) ; grid point height >>>> rh = wrf_user_getvar(f,"rh",-1) ; relative humidity >>>> >>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >>>> >>>> ;lat2d = wrf_user_getvar(f,"XLAT",0) >>>> ;lon2d = wrf_user_getvar(f,"XLONG",0) >>>> >>>> lat2d = f->XLAT(0,:,:) >>>> lon2d = f->XLONG(0,:,:) >>>> >>>> lat = lat2d(:,0) ; create classic 1D coordinate >>>> arrays >>>> lon = lon2d(0,:) >>>> >>>> ;u&lat at units = "degrees_north" >>>> ;u&lon at units = "degrees_east" >>>> ;v&lat at units = "degrees_north" >>>> ;v&lon at units = "degrees_east" >>>> >>>> ;lat at units= "degrees_north" >>>> ;lon at units= "degrees_east" >>>> ;lat!0 = "lat" >>>> ;lon!0 = "lon" >>>> ;lat&lat = lat >>>> ;lon&lon = lon >>>> >>>> >>>> ;pressure = pressure_levels(level) >>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >>>> pressure = pressure_levels(0) >>>> >>>> tc_plane = wrf_user_intrp3d(tc,p,"h",pressure,0.,False) >>>> z_plane = wrf_user_intrp3d( z,p,"h",pressure,0.,False) >>>> rh_plane = wrf_user_intrp3d(rh,p,"h",pressure,0.,False) >>>> u_plane = wrf_user_intrp3d( u,p,"h",pressure,0.,False) >>>> v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False) >>>> >>>> spd = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec >>>> spd at description = "Wind Speed" >>>> spd at units = "m/s" >>>> u_plane = u_plane*1.94386 ; kts >>>> v_plane = v_plane*1.94386 ; kts >>>> u_plane at units = "kts" >>>> v_plane at units = "kts" >>>> >>>> wks = gsn_open_wks("x11","gsn_csm_streamline_map") >>>> >>>> res = True >>>> res at gsnAddCyclic = False >>>> res at gsnMaximize = True >>>> res at gsnDraw = False ; don't draw yet >>>> res at gsnFrame = False ; don't advance yet >>>> >>>> res at tiMainString = "WRF Streamlines" ; draw a title >>>> res at gsnLeftString = "" >>>> res at gsnRightString = "" >>>> res at gsnCenterString = " " >>>> >>>> res at mpProjection = "Mercator" >>>> >>>> ;---Zoom in on map and plot again >>>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >>>> ;res at cnLineThicknessF = 2 ; make lines thicker, >>>> Default: 1 >>>> ;res at mpMinLatF = min(lat) ; zoom in on lat/lon area >>>> ;res at mpMaxLatF = max(lat) >>>> ;res at mpMinLonF = min(lon) >>>> ;res at mpMaxLonF = max(lon) >>>> >>>> res at mpDataBaseVersion = "MediumRes" ; better and more >>>> map outlines >>>> res at mpDataSetName = "Earth..4" >>>> res at mpOutlineBoundarySets = "AllBoundaries" >>>> res at mpOutlineOn = True >>>> res at mpNationalLineThicknessF = 2.5 ; turn on country >>>> boundaries >>>> >>>> res at lbOrientation = "Vertical" >>>> res at tiMainOffsetYF = -0.03 ; Move the title down >>>> >>>> plot = gsn_csm_streamline_map(wks,u_plane,v_plane,res) >>>> >>>> ;Define shapefiles >>>> ;***************** >>>> shp_filename = >>>> ("$HOME/DA/SCRIPTS/06_Utility_Files/Shapefiles/Lesotho/lso_admbnda_adm1_FAO_MLGCA_2019.shp") >>>> >>>> ;Set shapefile resources >>>> ;*********************** >>>> shpres = True >>>> shpres at gsLineThicknessF = 1 ; increase line >>>> thickness >>>> shpres at gsLineColor = "Black" ; line >>>> colorgsLineThicknessF >>>> shpres at gsLineDashPattern = 1 >>>> >>>> shp= gsn_add_shapefile_polylines(wks,plot,shp_filename,shpres) >>>> >>>> draw(plot) >>>> frame(wks) >>>> end >>>> _______________________________________________ >>>> ncl-talk mailing list >>>> ncl-talk at mailman.ucar.edu >>>> List instructions, subscriber options, unsubscribe: >>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>> >>> _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From setareh.rahimi at gmail.com Fri Oct 7 09:27:55 2022 From: setareh.rahimi at gmail.com (Setareh Rahimi) Date: Fri, 7 Oct 2022 18:57:55 +0330 Subject: [ncl-talk] How to define date for WRF-chem to get average daily of a variable ? In-Reply-To: References: Message-ID: Dear Dennis, I sent you the file via transfer.pcloud.com. I could not send it here due to the large size of the file. Please check the script with the file and let me know your idea. Many thanks for your help. Best wishes, On Fri, Oct 7, 2022 at 3:18 PM Dennis Shea wrote: > I do not understand 'x' either > > "I wonder about variable x; I did not define such a variable." > > ncl 0> f = addfile(".....","r") ; I do not have your file > ncl 1> print(f) ; like ncdump > -h > ncl 2> Times = f->Times ; Times(Time, > DateStrLen) (type character) > ncl 4> Time = wrf_times_c( Times, 0 ) ; "hours since" initial time on > file (double); units recognized by cd_calendar > ncl 5> print(Time) > > ncl 7> T = f->T > ncl 8> printVarSummary(T) > > ncl 9> T&Time = Time ; associate time > coordinate > ncl 10> printVarSummary(T) > > Variable: T > Type: float > Total Size: 19683000 bytes > 4920750 values > Number of Dimensions: 4 > Dimensions and sizes: [Time | ??] x [bottom_top | 27] x [south_north | 81] > x [west_east | 90] > Coordinates: > Time: [ 0.. ?] > Number Of Attributes: 5 > FieldType : 104 > MemoryOrder : XYZ > description : perturbation potential temperature (theta-t0) > units : K > stagger : > ncl 11> Tavg = calculate_daily_values (T, "avg", 0, True) > ncl 12> printVarSummary(Tavg) > > Variable: Tavg > Type: float > Total Size: 1574640 bytes > 393660 values > Number of Dimensions: 4 > Dimensions and sizes: [Time | ...] x [bottom_top | 27] x [south_north | > 81] x [west_east | 90] > Coordinates: > Time: [ 0.. 12] > Number Of Attributes: 8 > _FillValue : 9.96921e+36 > FieldType : 104 > MemoryOrder : XYZ > description : perturbation potential temperature (theta-t0) > units : K > stagger : > Time : 0 > NCL_tag : calculate_daily_values > > On Fri, Oct 7, 2022 at 5:16 AM Setareh Rahimi > wrote: > >> Dear Dennis, >> So many thanks for your advice. I made corrections to my script as you >> suggested, and attempted to calculate and plot the average AOD for >> 2011-06-28 but I still get errors. I attached the script and the errors. >> >> As you can see from the error message, NCL says :fatal: No coordinate >> variable exists for dimension (Time) in variable (x) >> I wonder about variable x; I did not define such a variable. >> >> Please advise me on how to sort this issue out. >> Many thanks in advance, >> Best wishes, >> >> On Fri, Oct 7, 2022 at 6:02 AM Dennis Shea wrote: >> >>> As noted in the documentation, *calculate_daily_values* >>> >>> requires that the variable have a **time coordinate** that is recognized by >>> cd_calendar. >>> >>> Times = f->Times ; Times(Time, DateStrLen) (type character) >>> Time = *wrf_times_c*( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar >>> >>> a2 = f->TAUAER ; (Time, south_north, west_east) >>> a2&Time = Time ; associate the 'Time' coordinate with the >>> variable using standard NCL & syntax >>> printVarSummary(a2) >>> print("------------------------------------") >>> >>> a2Day = calculate_daily_values (a2, "avg", 0, opt) >>> printVarSummary(a2Day) >>> printMinMax (a2Day,1) >>> >>> >>> >>> On Wed, Oct 5, 2022 at 9:30 AM Setareh Rahimi via ncl-talk < >>> ncl-talk at mailman.ucar.edu> wrote: >>> >>>> Dear NCL users, >>>> >>>> I am trying to plot the daily average of AOD (aerosol optical depth) >>>> from WRF-chem outputs. However, I can not define the time so that NCL plots >>>> the daily average of AOD.(the script has been attached, and the model >>>> output is too large and I just used ncdump to show the header of some >>>> varibles ). >>>> I tried the following commands: >>>> >>>> >>>> times = wrf_user_getvar(f,"times",-1) >>>> printVarSummary(times) >>>> print(times) >>>> ymdh = cd_calendar(a2×, -2) >>>> print(ymdh) >>>> >>>> but faced an error. >>>> Would you please kindly advise me on how can I calculate the daily >>>> average of AOD from the hourly output of WRF-chem? >>>> Many thanks in advance, >>>> Best wishes, >>>> -- >>>> S.Rahimi >>>> >>>> _______________________________________________ >>>> ncl-talk mailing list >>>> ncl-talk at mailman.ucar.edu >>>> List instructions, subscriber options, unsubscribe: >>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>> >>> >> >> -- >> S.Rahimi >> >> -- S.Rahimi -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Fri Oct 7 10:13:58 2022 From: shea at ucar.edu (Dennis Shea) Date: Fri, 7 Oct 2022 10:13:58 -0600 Subject: [ncl-talk] How to define date for WRF-chem to get average daily of a variable ? In-Reply-To: References: Message-ID: The file is about 5GB. ncl-talk does not need the entire file. DO you have the netCDF operators available? %> ncks -v Times,TAUAER2,TAUAER3,XLAT,XLONG wrfout_d01_2011-07-01_00:00:12 setareh_chem.nc Further, compress 'setareh_chem.nc' using gzip %> gzip setareh_chem.nc This [setareh_chem.nc.gz] will be substantially smaller. On Fri, Oct 7, 2022 at 9:28 AM Setareh Rahimi wrote: > Dear Dennis, > I sent you the file via transfer.pcloud.com. I could not send it here due > to the large size of the file. > Please check the script with the file and let me know your idea. > Many thanks for your help. > Best wishes, > > On Fri, Oct 7, 2022 at 3:18 PM Dennis Shea wrote: > >> I do not understand 'x' either >> >> "I wonder about variable x; I did not define such a variable." >> >> ncl 0> f = addfile(".....","r") ; I do not have your file >> ncl 1> print(f) ; like ncdump >> -h >> ncl 2> Times = f->Times ; Times(Time, >> DateStrLen) (type character) >> ncl 4> Time = wrf_times_c( Times, 0 ) ; "hours since" initial time >> on file (double); units recognized by cd_calendar >> ncl 5> print(Time) >> >> ncl 7> T = f->T >> ncl 8> printVarSummary(T) >> >> ncl 9> T&Time = Time ; associate time >> coordinate >> ncl 10> printVarSummary(T) >> >> Variable: T >> Type: float >> Total Size: 19683000 bytes >> 4920750 values >> Number of Dimensions: 4 >> Dimensions and sizes: [Time | ??] x [bottom_top | 27] x [south_north | >> 81] x [west_east | 90] >> Coordinates: >> Time: [ 0.. ?] >> Number Of Attributes: 5 >> FieldType : 104 >> MemoryOrder : XYZ >> description : perturbation potential temperature (theta-t0) >> units : K >> stagger : >> ncl 11> Tavg = calculate_daily_values (T, "avg", 0, True) >> ncl 12> printVarSummary(Tavg) >> >> Variable: Tavg >> Type: float >> Total Size: 1574640 bytes >> 393660 values >> Number of Dimensions: 4 >> Dimensions and sizes: [Time | ...] x [bottom_top | 27] x [south_north | >> 81] x [west_east | 90] >> Coordinates: >> Time: [ 0.. 12] >> Number Of Attributes: 8 >> _FillValue : 9.96921e+36 >> FieldType : 104 >> MemoryOrder : XYZ >> description : perturbation potential temperature (theta-t0) >> units : K >> stagger : >> Time : 0 >> NCL_tag : calculate_daily_values >> >> On Fri, Oct 7, 2022 at 5:16 AM Setareh Rahimi >> wrote: >> >>> Dear Dennis, >>> So many thanks for your advice. I made corrections to my script as you >>> suggested, and attempted to calculate and plot the average AOD for >>> 2011-06-28 but I still get errors. I attached the script and the errors. >>> >>> As you can see from the error message, NCL says :fatal: No coordinate >>> variable exists for dimension (Time) in variable (x) >>> I wonder about variable x; I did not define such a variable. >>> >>> Please advise me on how to sort this issue out. >>> Many thanks in advance, >>> Best wishes, >>> >>> On Fri, Oct 7, 2022 at 6:02 AM Dennis Shea wrote: >>> >>>> As noted in the documentation, *calculate_daily_values* >>>> >>>> requires that the variable have a **time coordinate** that is recognized by >>>> cd_calendar. >>>> >>>> Times = f->Times ; Times(Time, DateStrLen) (type character) >>>> Time = *wrf_times_c*( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar >>>> >>>> a2 = f->TAUAER ; (Time, south_north, west_east) >>>> a2&Time = Time ; associate the 'Time' coordinate with the >>>> variable using standard NCL & syntax >>>> printVarSummary(a2) >>>> print("------------------------------------") >>>> >>>> a2Day = calculate_daily_values (a2, "avg", 0, opt) >>>> printVarSummary(a2Day) >>>> printMinMax (a2Day,1) >>>> >>>> >>>> >>>> On Wed, Oct 5, 2022 at 9:30 AM Setareh Rahimi via ncl-talk < >>>> ncl-talk at mailman.ucar.edu> wrote: >>>> >>>>> Dear NCL users, >>>>> >>>>> I am trying to plot the daily average of AOD (aerosol optical depth) >>>>> from WRF-chem outputs. However, I can not define the time so that NCL plots >>>>> the daily average of AOD.(the script has been attached, and the model >>>>> output is too large and I just used ncdump to show the header of some >>>>> varibles ). >>>>> I tried the following commands: >>>>> >>>>> >>>>> times = wrf_user_getvar(f,"times",-1) >>>>> printVarSummary(times) >>>>> print(times) >>>>> ymdh = cd_calendar(a2×, -2) >>>>> print(ymdh) >>>>> >>>>> but faced an error. >>>>> Would you please kindly advise me on how can I calculate the daily >>>>> average of AOD from the hourly output of WRF-chem? >>>>> Many thanks in advance, >>>>> Best wishes, >>>>> -- >>>>> S.Rahimi >>>>> >>>>> _______________________________________________ >>>>> ncl-talk mailing list >>>>> ncl-talk at mailman.ucar.edu >>>>> List instructions, subscriber options, unsubscribe: >>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>>> >>>> >>> >>> -- >>> S.Rahimi >>> >>> > > -- > S.Rahimi > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From setareh.rahimi at gmail.com Fri Oct 7 10:35:02 2022 From: setareh.rahimi at gmail.com (Setareh Rahimi) Date: Fri, 7 Oct 2022 20:05:02 +0330 Subject: [ncl-talk] How to define date for WRF-chem to get average daily of a variable ? In-Reply-To: References: Message-ID: Dear Dennis, Thank you for your great advice. Yes, I could compress the file. Please check the attached file. setareh_chem.nc.gz Best wishes, On Fri, Oct 7, 2022 at 7:44 PM Dennis Shea wrote: > The file is about 5GB. > > ncl-talk does not need the entire file. > > DO you have the netCDF operators available? > > %> ncks -v Times,TAUAER2,TAUAER3,XLAT,XLONG > wrfout_d01_2011-07-01_00:00:12 setareh_chem.nc > > Further, compress 'setareh_chem.nc' using gzip > > %> gzip setareh_chem.nc > > > This [setareh_chem.nc.gz] will be substantially smaller. > > > On Fri, Oct 7, 2022 at 9:28 AM Setareh Rahimi > wrote: > >> Dear Dennis, >> I sent you the file via transfer.pcloud.com. I could not send it here >> due to the large size of the file. >> Please check the script with the file and let me know your idea. >> Many thanks for your help. >> Best wishes, >> >> On Fri, Oct 7, 2022 at 3:18 PM Dennis Shea wrote: >> >>> I do not understand 'x' either >>> >>> "I wonder about variable x; I did not define such a variable." >>> >>> ncl 0> f = addfile(".....","r") ; I do not have your file >>> ncl 1> print(f) ; like >>> ncdump -h >>> ncl 2> Times = f->Times ; Times(Time, >>> DateStrLen) (type character) >>> ncl 4> Time = wrf_times_c( Times, 0 ) ; "hours since" initial time >>> on file (double); units recognized by cd_calendar >>> ncl 5> print(Time) >>> >>> ncl 7> T = f->T >>> ncl 8> printVarSummary(T) >>> >>> ncl 9> T&Time = Time ; associate time >>> coordinate >>> ncl 10> printVarSummary(T) >>> >>> Variable: T >>> Type: float >>> Total Size: 19683000 bytes >>> 4920750 values >>> Number of Dimensions: 4 >>> Dimensions and sizes: [Time | ??] x [bottom_top | 27] x [south_north | >>> 81] x [west_east | 90] >>> Coordinates: >>> Time: [ 0.. ?] >>> Number Of Attributes: 5 >>> FieldType : 104 >>> MemoryOrder : XYZ >>> description : perturbation potential temperature (theta-t0) >>> units : K >>> stagger : >>> ncl 11> Tavg = calculate_daily_values (T, "avg", 0, True) >>> ncl 12> printVarSummary(Tavg) >>> >>> Variable: Tavg >>> Type: float >>> Total Size: 1574640 bytes >>> 393660 values >>> Number of Dimensions: 4 >>> Dimensions and sizes: [Time | ...] x [bottom_top | 27] x [south_north | >>> 81] x [west_east | 90] >>> Coordinates: >>> Time: [ 0.. 12] >>> Number Of Attributes: 8 >>> _FillValue : 9.96921e+36 >>> FieldType : 104 >>> MemoryOrder : XYZ >>> description : perturbation potential temperature (theta-t0) >>> units : K >>> stagger : >>> Time : 0 >>> NCL_tag : calculate_daily_values >>> >>> On Fri, Oct 7, 2022 at 5:16 AM Setareh Rahimi >>> wrote: >>> >>>> Dear Dennis, >>>> So many thanks for your advice. I made corrections to my script as you >>>> suggested, and attempted to calculate and plot the average AOD for >>>> 2011-06-28 but I still get errors. I attached the script and the errors. >>>> >>>> As you can see from the error message, NCL says :fatal: No coordinate >>>> variable exists for dimension (Time) in variable (x) >>>> I wonder about variable x; I did not define such a variable. >>>> >>>> Please advise me on how to sort this issue out. >>>> Many thanks in advance, >>>> Best wishes, >>>> >>>> On Fri, Oct 7, 2022 at 6:02 AM Dennis Shea wrote: >>>> >>>>> As noted in the documentation, *calculate_daily_values* >>>>> >>>>> requires that the variable have a **time coordinate** that is recognized by >>>>> cd_calendar. >>>>> >>>>> Times = f->Times ; Times(Time, DateStrLen) (type character) >>>>> Time = *wrf_times_c*( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar >>>>> >>>>> a2 = f->TAUAER ; (Time, south_north, west_east) >>>>> a2&Time = Time ; associate the 'Time' coordinate with the >>>>> variable using standard NCL & syntax >>>>> printVarSummary(a2) >>>>> print("------------------------------------") >>>>> >>>>> a2Day = calculate_daily_values (a2, "avg", 0, opt) >>>>> printVarSummary(a2Day) >>>>> printMinMax (a2Day,1) >>>>> >>>>> >>>>> >>>>> On Wed, Oct 5, 2022 at 9:30 AM Setareh Rahimi via ncl-talk < >>>>> ncl-talk at mailman.ucar.edu> wrote: >>>>> >>>>>> Dear NCL users, >>>>>> >>>>>> I am trying to plot the daily average of AOD (aerosol optical depth) >>>>>> from WRF-chem outputs. However, I can not define the time so that NCL plots >>>>>> the daily average of AOD.(the script has been attached, and the model >>>>>> output is too large and I just used ncdump to show the header of some >>>>>> varibles ). >>>>>> I tried the following commands: >>>>>> >>>>>> >>>>>> times = wrf_user_getvar(f,"times",-1) >>>>>> printVarSummary(times) >>>>>> print(times) >>>>>> ymdh = cd_calendar(a2×, -2) >>>>>> print(ymdh) >>>>>> >>>>>> but faced an error. >>>>>> Would you please kindly advise me on how can I calculate the daily >>>>>> average of AOD from the hourly output of WRF-chem? >>>>>> Many thanks in advance, >>>>>> Best wishes, >>>>>> -- >>>>>> S.Rahimi >>>>>> >>>>>> _______________________________________________ >>>>>> ncl-talk mailing list >>>>>> ncl-talk at mailman.ucar.edu >>>>>> List instructions, subscriber options, unsubscribe: >>>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>>>> >>>>> >>>> >>>> -- >>>> S.Rahimi >>>> >>>> >> >> -- >> S.Rahimi >> >> -- S.Rahimi -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Fri Oct 7 12:01:40 2022 From: shea at ucar.edu (Dennis Shea) Date: Fri, 7 Oct 2022 12:01:40 -0600 Subject: [ncl-talk] How to define date for WRF-chem to get average daily of a variable ? In-Reply-To: References: Message-ID: My script follows.. There were no problems. The output is attached. ++++++++++++++++++++++++++++++++++++++++++++++++++++ load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" f = addfile("setareh_chem.nc","r") print(f) ; same as "nmcdump -h" Times = f->Times ; [Time | 41] x [DateStrLen | 19] (character) ; For fun: Examine "Times" in different formats Time_0 = wrf_times_c( Times, 0 ) ; "hours since" initial time on file (double) ; Time_0 is recognized by cd_calendar ;Time_1 = wrf_times_c( Times, 1 ) ; "hours since 1901-01-01 00:00:00" (double) ;Time_2 = wrf_times_c( Times, 2 ) ; yyyymmddhhmnss (double) Time_3 = wrf_times_c( Times, 3 ) ; yyyymmddhh (integer) ;print(Times) ;print(Time_0) ;print(Time_1) ;print(Time_2) print(Time_3) ; easy on the eyes print("------------------------------------") a2 = f->TAUAER2 ; (Time, south_north, west_east) a2&Time = Time_0 ; associate the 'Time' coordinate with the variable using standard NCL & syntax printVarSummary(a2) print("------------------------------------") opt_cdv = True ; option for calculate_daily_values (cdv) opt_cdv at nval_crit = 4 ; default is 1 a2Day = calculate_daily_values (a2, "avg", 0, opt_cdv) printVarSummary(a2Day) printMinMax (a2Day,1) On Fri, Oct 7, 2022 at 9:28 AM Setareh Rahimi wrote: > Dear Dennis, > I sent you the file via transfer.pcloud.com. I could not send it here due > to the large size of the file. > Please check the script with the file and let me know your idea. > Many thanks for your help. > Best wishes, > > On Fri, Oct 7, 2022 at 3:18 PM Dennis Shea wrote: > >> I do not understand 'x' either >> >> "I wonder about variable x; I did not define such a variable." >> >> ncl 0> f = addfile(".....","r") ; I do not have your file >> ncl 1> print(f) ; like ncdump >> -h >> ncl 2> Times = f->Times ; Times(Time, >> DateStrLen) (type character) >> ncl 4> Time = wrf_times_c( Times, 0 ) ; "hours since" initial time >> on file (double); units recognized by cd_calendar >> ncl 5> print(Time) >> >> ncl 7> T = f->T >> ncl 8> printVarSummary(T) >> >> ncl 9> T&Time = Time ; associate time >> coordinate >> ncl 10> printVarSummary(T) >> >> Variable: T >> Type: float >> Total Size: 19683000 bytes >> 4920750 values >> Number of Dimensions: 4 >> Dimensions and sizes: [Time | ??] x [bottom_top | 27] x [south_north | >> 81] x [west_east | 90] >> Coordinates: >> Time: [ 0.. ?] >> Number Of Attributes: 5 >> FieldType : 104 >> MemoryOrder : XYZ >> description : perturbation potential temperature (theta-t0) >> units : K >> stagger : >> ncl 11> Tavg = calculate_daily_values (T, "avg", 0, True) >> ncl 12> printVarSummary(Tavg) >> >> Variable: Tavg >> Type: float >> Total Size: 1574640 bytes >> 393660 values >> Number of Dimensions: 4 >> Dimensions and sizes: [Time | ...] x [bottom_top | 27] x [south_north | >> 81] x [west_east | 90] >> Coordinates: >> Time: [ 0.. 12] >> Number Of Attributes: 8 >> _FillValue : 9.96921e+36 >> FieldType : 104 >> MemoryOrder : XYZ >> description : perturbation potential temperature (theta-t0) >> units : K >> stagger : >> Time : 0 >> NCL_tag : calculate_daily_values >> >> On Fri, Oct 7, 2022 at 5:16 AM Setareh Rahimi >> wrote: >> >>> Dear Dennis, >>> So many thanks for your advice. I made corrections to my script as you >>> suggested, and attempted to calculate and plot the average AOD for >>> 2011-06-28 but I still get errors. I attached the script and the errors. >>> >>> As you can see from the error message, NCL says :fatal: No coordinate >>> variable exists for dimension (Time) in variable (x) >>> I wonder about variable x; I did not define such a variable. >>> >>> Please advise me on how to sort this issue out. >>> Many thanks in advance, >>> Best wishes, >>> >>> On Fri, Oct 7, 2022 at 6:02 AM Dennis Shea wrote: >>> >>>> As noted in the documentation, *calculate_daily_values* >>>> >>>> requires that the variable have a **time coordinate** that is recognized by >>>> cd_calendar. >>>> >>>> Times = f->Times ; Times(Time, DateStrLen) (type character) >>>> Time = *wrf_times_c*( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar >>>> >>>> a2 = f->TAUAER ; (Time, south_north, west_east) >>>> a2&Time = Time ; associate the 'Time' coordinate with the >>>> variable using standard NCL & syntax >>>> printVarSummary(a2) >>>> print("------------------------------------") >>>> >>>> a2Day = calculate_daily_values (a2, "avg", 0, opt) >>>> printVarSummary(a2Day) >>>> printMinMax (a2Day,1) >>>> >>>> >>>> >>>> On Wed, Oct 5, 2022 at 9:30 AM Setareh Rahimi via ncl-talk < >>>> ncl-talk at mailman.ucar.edu> wrote: >>>> >>>>> Dear NCL users, >>>>> >>>>> I am trying to plot the daily average of AOD (aerosol optical depth) >>>>> from WRF-chem outputs. However, I can not define the time so that NCL plots >>>>> the daily average of AOD.(the script has been attached, and the model >>>>> output is too large and I just used ncdump to show the header of some >>>>> varibles ). >>>>> I tried the following commands: >>>>> >>>>> >>>>> times = wrf_user_getvar(f,"times",-1) >>>>> printVarSummary(times) >>>>> print(times) >>>>> ymdh = cd_calendar(a2×, -2) >>>>> print(ymdh) >>>>> >>>>> but faced an error. >>>>> Would you please kindly advise me on how can I calculate the daily >>>>> average of AOD from the hourly output of WRF-chem? >>>>> Many thanks in advance, >>>>> Best wishes, >>>>> -- >>>>> S.Rahimi >>>>> >>>>> _______________________________________________ >>>>> ncl-talk mailing list >>>>> ncl-talk at mailman.ucar.edu >>>>> List instructions, subscriber options, unsubscribe: >>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>>> >>>> >>> >>> -- >>> S.Rahimi >>> >>> > > -- > S.Rahimi > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: setareh_chem.OUTPUT Type: application/octet-stream Size: 8503 bytes Desc: not available URL: From tabishumaransari at gmail.com Sat Oct 8 06:34:27 2022 From: tabishumaransari at gmail.com (Tabish Ansari) Date: Sat, 8 Oct 2022 14:34:27 +0200 Subject: [ncl-talk] Bash variables not being read via system() function Message-ID: Hello, I have a small shell script *myscript.sh* which takes 13 arguments: start day, and 12 values of emission levels. For now, it just echoes them back on the screen. I'm supplying these 13 numbers via an NCL script by writing them out to a text file and reading them again in the shell. NCL is nicely writing these text files out and myscript.sh is able to pick these arguments when I write the command in bash. However, when I try to achieve the same from inside NCL using the system() function, the shell script isn't able to read these arguments. Here's *myscript.sh:* #!/bin/bash echo day=$1 echo Ai=$2 echo Ap=$3 echo At=$4 echo Ar=$5 echo Bi=$6 echo Bp=$7 echo Bt=$8 echo Br=$9 echo Ci=${10} echo Cp=${11} echo Ct=${12} echo Cr=${13} And here's my NCL script: begin SD = 02 ; start day baseline = (/100,100,100,100,100,100,100,100,100,100,100,100/) emis = baseline print("PREPARING EMISSIONS: "+emis(0)+" "+emis(1)+" "+emis(2)+" "+emis(3)+" "+emis(4)+" "+emis(5)+" "+emis(6)+" "+emis(7)+" "+emis(8)+" "+emis(9)+" "+emis(10)+" "+emis(11)) asciiwrite("emisstring.txt",emis) asciiwrite("SD.txt",SD) system("./myscript.sh $( From setareh.rahimi at gmail.com Sat Oct 8 07:05:51 2022 From: setareh.rahimi at gmail.com (Setareh Rahimi) Date: Sat, 8 Oct 2022 16:35:51 +0330 Subject: [ncl-talk] How to define date for WRF-chem to get average daily of a variable ? In-Reply-To: References: Message-ID: Dear Dennis, I executed the script you send. It also worked for me. But may I ask you please to execute the attached script? Thanks in advance, Best wishes, On Fri, Oct 7, 2022 at 10:57 PM Dennis Shea wrote: > Yes, I did "execute the entire script" I sent you. > > %> /project/cas/shea/WRF> ncl setareh_chem.ncl >! setareh_chem.OUTPUT > ==================================== > > My script has no "x" > > I have no idea where or what the variable "x" is. > > Did you execute the script I sent you ? > > > > On Fri, Oct 7, 2022 at 1:02 PM Setareh Rahimi > wrote: > >> Dear Dennis, >> Did you execute the entire script? >> Cause I still get errors! (attached) >> >> On Fri, Oct 7, 2022 at 9:31 PM Dennis Shea wrote: >> >>> My script follows.. There were no problems. The output is attached. >>> >>> ++++++++++++++++++++++++++++++++++++++++++++++++++++ >>> >>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" >>> >>> f = addfile("setareh_chem.nc","r") >>> print(f) ; same as "nmcdump -h" >>> >>> Times = f->Times ; [Time | 41] x [DateStrLen | >>> 19] (character) >>> >>> ; For fun: Examine "Times" in different formats >>> >>> Time_0 = wrf_times_c( Times, 0 ) ; "hours since" initial time on >>> file (double) >>> ; Time_0 >>> is recognized by cd_calendar >>> ;Time_1 = wrf_times_c( Times, 1 ) ; "hours since 1901-01-01 >>> 00:00:00" (double) >>> ;Time_2 = wrf_times_c( Times, 2 ) ; yyyymmddhhmnss >>> (double) >>> Time_3 = wrf_times_c( Times, 3 ) ; yyyymmddhh >>> (integer) >>> >>> ;print(Times) >>> ;print(Time_0) >>> ;print(Time_1) >>> ;print(Time_2) >>> print(Time_3) ; easy on the eyes >>> print("------------------------------------") >>> >>> a2 = f->TAUAER2 ; (Time, south_north, west_east) >>> a2&Time = Time_0 ; associate the 'Time' >>> coordinate with the variable using standard NCL & syntax >>> printVarSummary(a2) >>> print("------------------------------------") >>> >>> opt_cdv = True ; option for calculate_daily_values (cdv) >>> opt_cdv at nval_crit = 4 ; default is 1 >>> >>> a2Day = calculate_daily_values (a2, "avg", 0, opt_cdv) >>> printVarSummary(a2Day) >>> printMinMax (a2Day,1) >>> >>> On Fri, Oct 7, 2022 at 9:28 AM Setareh Rahimi >>> wrote: >>> >>>> Dear Dennis, >>>> I sent you the file via transfer.pcloud.com. I could not send it here >>>> due to the large size of the file. >>>> Please check the script with the file and let me know your idea. >>>> Many thanks for your help. >>>> Best wishes, >>>> >>>> On Fri, Oct 7, 2022 at 3:18 PM Dennis Shea wrote: >>>> >>>>> I do not understand 'x' either >>>>> >>>>> "I wonder about variable x; I did not define such a variable." >>>>> >>>>> ncl 0> f = addfile(".....","r") ; I do not have your file >>>>> ncl 1> print(f) ; like >>>>> ncdump -h >>>>> ncl 2> Times = f->Times ; Times(Time, >>>>> DateStrLen) (type character) >>>>> ncl 4> Time = wrf_times_c( Times, 0 ) ; "hours since" initial >>>>> time on file (double); units recognized by cd_calendar >>>>> ncl 5> print(Time) >>>>> >>>>> ncl 7> T = f->T >>>>> ncl 8> printVarSummary(T) >>>>> >>>>> ncl 9> T&Time = Time ; associate time >>>>> coordinate >>>>> ncl 10> printVarSummary(T) >>>>> >>>>> Variable: T >>>>> Type: float >>>>> Total Size: 19683000 bytes >>>>> 4920750 values >>>>> Number of Dimensions: 4 >>>>> Dimensions and sizes: [Time | ??] x [bottom_top | 27] x [south_north | >>>>> 81] x [west_east | 90] >>>>> Coordinates: >>>>> Time: [ 0.. ?] >>>>> Number Of Attributes: 5 >>>>> FieldType : 104 >>>>> MemoryOrder : XYZ >>>>> description : perturbation potential temperature (theta-t0) >>>>> units : K >>>>> stagger : >>>>> ncl 11> Tavg = calculate_daily_values (T, "avg", 0, True) >>>>> ncl 12> printVarSummary(Tavg) >>>>> >>>>> Variable: Tavg >>>>> Type: float >>>>> Total Size: 1574640 bytes >>>>> 393660 values >>>>> Number of Dimensions: 4 >>>>> Dimensions and sizes: [Time | ...] x [bottom_top | 27] x [south_north >>>>> | 81] x [west_east | 90] >>>>> Coordinates: >>>>> Time: [ 0.. 12] >>>>> Number Of Attributes: 8 >>>>> _FillValue : 9.96921e+36 >>>>> FieldType : 104 >>>>> MemoryOrder : XYZ >>>>> description : perturbation potential temperature (theta-t0) >>>>> units : K >>>>> stagger : >>>>> Time : 0 >>>>> NCL_tag : calculate_daily_values >>>>> >>>>> On Fri, Oct 7, 2022 at 5:16 AM Setareh Rahimi < >>>>> setareh.rahimi at gmail.com> wrote: >>>>> >>>>>> Dear Dennis, >>>>>> So many thanks for your advice. I made corrections to my script as >>>>>> you suggested, and attempted to calculate and plot the average AOD for >>>>>> 2011-06-28 but I still get errors. I attached the script and the errors. >>>>>> >>>>>> As you can see from the error message, NCL says :fatal: No >>>>>> coordinate variable exists for dimension (Time) in variable (x) >>>>>> I wonder about variable x; I did not define such a variable. >>>>>> >>>>>> Please advise me on how to sort this issue out. >>>>>> Many thanks in advance, >>>>>> Best wishes, >>>>>> >>>>>> On Fri, Oct 7, 2022 at 6:02 AM Dennis Shea wrote: >>>>>> >>>>>>> As noted in the documentation, *calculate_daily_values* >>>>>>> >>>>>>> requires that the variable have a **time coordinate** that is recognized by >>>>>>> cd_calendar. >>>>>>> >>>>>>> Times = f->Times ; Times(Time, DateStrLen) (type character) >>>>>>> Time = *wrf_times_c*( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar >>>>>>> >>>>>>> a2 = f->TAUAER ; (Time, south_north, west_east) >>>>>>> a2&Time = Time ; associate the 'Time' coordinate with the >>>>>>> variable using standard NCL & syntax >>>>>>> printVarSummary(a2) >>>>>>> print("------------------------------------") >>>>>>> >>>>>>> a2Day = calculate_daily_values (a2, "avg", 0, opt) >>>>>>> printVarSummary(a2Day) >>>>>>> printMinMax (a2Day,1) >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Wed, Oct 5, 2022 at 9:30 AM Setareh Rahimi via ncl-talk < >>>>>>> ncl-talk at mailman.ucar.edu> wrote: >>>>>>> >>>>>>>> Dear NCL users, >>>>>>>> >>>>>>>> I am trying to plot the daily average of AOD (aerosol optical >>>>>>>> depth) from WRF-chem outputs. However, I can not define the time so that >>>>>>>> NCL plots the daily average of AOD.(the script has been attached, and the >>>>>>>> model output is too large and I just used ncdump to show the header of some >>>>>>>> varibles ). >>>>>>>> I tried the following commands: >>>>>>>> >>>>>>>> >>>>>>>> times = wrf_user_getvar(f,"times",-1) >>>>>>>> printVarSummary(times) >>>>>>>> print(times) >>>>>>>> ymdh = cd_calendar(a2×, -2) >>>>>>>> print(ymdh) >>>>>>>> >>>>>>>> but faced an error. >>>>>>>> Would you please kindly advise me on how can I calculate the daily >>>>>>>> average of AOD from the hourly output of WRF-chem? >>>>>>>> Many thanks in advance, >>>>>>>> Best wishes, >>>>>>>> -- >>>>>>>> S.Rahimi >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> ncl-talk mailing list >>>>>>>> ncl-talk at mailman.ucar.edu >>>>>>>> List instructions, subscriber options, unsubscribe: >>>>>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>>>>>> >>>>>>> >>>>>> >>>>>> -- >>>>>> S.Rahimi >>>>>> >>>>>> >>>> >>>> -- >>>> S.Rahimi >>>> >>>> >> >> -- >> S.Rahimi >> >> -- S.Rahimi -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" ;*************************************************************************************************************************** f = addfile ("wrfout_d01_2011-07-01_00:00:12", "r") print(f) ; same as "nmcdump -h" Times = f->Times ; [Time | 41] x [DateStrLen | 19] (character) Time_0 = wrf_times_c( Times, 0 ) ; "hours since" initial time on file (double) ; Time_0 is recognized by cd_calendar print("********************************************************************************************************************") wks = gsn_open_wks("pdf" ,"WRF_aod_Daily-Average") ; ps,pdf,x11,ncgm,eps gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; select color map res = True ; plot mods desired res at cnConstFEnableFill = True res at gsnMaximize = True res at gsnSpreadColors = True res at cnFillOn = True res at cnLinesOn = False res at cnLineLabelsOn = False WRF_map_c(f, res, 0) res at tfDoNDCOverlay = True res at pmTickMarkDisplayMode = "Always" ;*************************************************************************************************************************** ymd = cd_calendar(Time_0, -2) YMD = 20110701 mt = ind(YMD.eq.ymd) a2 = f->TAUAER2(mt,:,:,:) ; (Time, south_north, west_east) a2&Time = Time_0 ; associate the 'Time' coordinate with the variable using standard NCL & syntax printVarSummary(a2) print(ymd) print("********************************************************************************************************************") opt_cdv = True ; option for calculate_daily_values (cdv) opt_cdv at nval_crit = 4 ; default is 1 a2Day = calculate_daily_values (a2, "avg", 0, opt_cdv) printVarSummary(a2Day) printMinMax (a2Day,1) b3 = f->TAUAER3(mt,:,:,:) b3Day = calculate_daily_values (b3, "avg", 0, opt_cdv) printVarSummary(bDay) printMinMax (bDay,1) ;******************************************************************************************************************** ;******************************************************************************************************************** angstrom_exponent = -(log(a2Day)-log(b3Day))/log(400/600) printVarSummary(angstrom_exponent) AOD550_3D = a2Day * ((400/550)^angstrom_exponent) printVarSummary(AOD550_3D) AOD550_2D = dim_sum_n_Wrap(AOD550_3D,0) if (any(isnan_ieee(AOD550_2D))) then value = 9.96921e+36 replace_ieeenan (AOD550_2D,value,0) AOD550_2D at _FillValue = value end if printVarSummary(AOD550_2D) printMinMax (AOD550_2D,1) res at tiMainString = "WRF-CHEM (aod_550) " + times(mt) res at gsnLeftString = a at description plot = gsn_csm_contour_map(wks,AOD550_2D(:,:),res) end -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 1401-07-16 at 4.28.26 PM.png Type: image/png Size: 145175 bytes Desc: not available URL: From dave.allured at noaa.gov Sat Oct 8 07:31:38 2022 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Sat, 8 Oct 2022 07:31:38 -0600 Subject: [ncl-talk] Bash variables not being read via system() function In-Reply-To: References: Message-ID: Tabish, I do not know what is wrong with the system() command the way you wrote it. However, I suggest a simpler approach. It is easy to directly pass simple string command line arguments to a shell command through system(). Do not use asciiwrite or text files. cd_string = tostring (cd) emis_string = str_join (tostring (emis), " ") system ("./myscript.sh " + cd_string + " " + emis_string) Take care to include intervening spaces between all arguments to the shell command, as shown here. You could also write "cd" directly, because NCL automatically converts scalar numbers to strings when doing string concatenation: emis_string = str_join (tostring (emis), " ") system ("./myscript.sh " + cd + " " + emis_string) On Sat, Oct 8, 2022 at 6:34 AM Tabish Ansari via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hello, > > I have a small shell script *myscript.sh* which takes 13 arguments: start > day, and 12 values of emission levels. For now, it just echoes them back on > the screen. > > I'm supplying these 13 numbers via an NCL script by writing them out to a > text file and reading them again in the shell. NCL is nicely writing these > text files out and myscript.sh is able to pick these arguments when I write > the command in bash. However, when I try to achieve the same from inside > NCL using the system() function, the shell script isn't able to read these > arguments. > > Here's *myscript.sh:* > #!/bin/bash > echo day=$1 > echo Ai=$2 > echo Ap=$3 > echo At=$4 > echo Ar=$5 > echo Bi=$6 > echo Bp=$7 > echo Bt=$8 > echo Br=$9 > echo Ci=${10} > echo Cp=${11} > echo Ct=${12} > echo Cr=${13} > > And here's my NCL script: > begin > > SD = 02 ; start day > baseline = (/100,100,100,100,100,100,100,100,100,100,100,100/) > > emis = baseline > print("PREPARING EMISSIONS: "+emis(0)+" "+emis(1)+" "+emis(2)+" > "+emis(3)+" "+emis(4)+" "+emis(5)+" "+emis(6)+" "+emis(7)+" "+emis(8)+" > "+emis(9)+" "+emis(10)+" "+emis(11)) > > asciiwrite("emisstring.txt",emis) > asciiwrite("SD.txt",SD) > > system("./myscript.sh $( > end > > These two scripts are self-sufficient and you can easily copy-paste and > test them on your system. Please let me know what's wrong here. > > Thanks a lot. > > Tabish > ------------------------------- > Dr Tabish Ansari > Research Associate > Air Quality Modelling Group > IASS-Potsdam > Germany > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tabishumaransari at gmail.com Sat Oct 8 07:59:26 2022 From: tabishumaransari at gmail.com (Tabish Ansari) Date: Sat, 8 Oct 2022 15:59:26 +0200 Subject: [ncl-talk] Bash variables not being read via system() function In-Reply-To: References: Message-ID: Thanks a lot Dave, that works! I was not aware that one can also send arguments from within NCL to the shell, that's why I was writing them out to ASCII files and then reading them again in the shell. But this is more efficient. Still, don't know why it wasn't working that way. Thanks again. best wishes, Tabish ------------------------------- Dr Tabish Ansari Research Associate Air Quality Modelling Group IASS-Potsdam Germany On Sat, 8 Oct 2022 at 15:31, Dave Allured - NOAA Affiliate < dave.allured at noaa.gov> wrote: > Tabish, I do not know what is wrong with the system() command the way you > wrote it. However, I suggest a simpler approach. It is easy to directly > pass simple string command line arguments to a shell command through > system(). Do not use asciiwrite or text files. > > cd_string = tostring (cd) > emis_string = str_join (tostring (emis), " ") > system ("./myscript.sh " + cd_string + " " + emis_string) > > Take care to include intervening spaces between all arguments to the shell > command, as shown here. You could also write "cd" directly, because NCL > automatically converts scalar numbers to strings when doing string > concatenation: > > emis_string = str_join (tostring (emis), " ") > system ("./myscript.sh " + cd + " " + emis_string) > > > On Sat, Oct 8, 2022 at 6:34 AM Tabish Ansari via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hello, >> >> I have a small shell script *myscript.sh* which takes 13 arguments: >> start day, and 12 values of emission levels. For now, it just echoes them >> back on the screen. >> >> I'm supplying these 13 numbers via an NCL script by writing them out to a >> text file and reading them again in the shell. NCL is nicely writing these >> text files out and myscript.sh is able to pick these arguments when I write >> the command in bash. However, when I try to achieve the same from inside >> NCL using the system() function, the shell script isn't able to read these >> arguments. >> >> Here's *myscript.sh:* >> #!/bin/bash >> echo day=$1 >> echo Ai=$2 >> echo Ap=$3 >> echo At=$4 >> echo Ar=$5 >> echo Bi=$6 >> echo Bp=$7 >> echo Bt=$8 >> echo Br=$9 >> echo Ci=${10} >> echo Cp=${11} >> echo Ct=${12} >> echo Cr=${13} >> >> And here's my NCL script: >> begin >> >> SD = 02 ; start day >> baseline = (/100,100,100,100,100,100,100,100,100,100,100,100/) >> >> emis = baseline >> print("PREPARING EMISSIONS: "+emis(0)+" "+emis(1)+" "+emis(2)+" >> "+emis(3)+" "+emis(4)+" "+emis(5)+" "+emis(6)+" "+emis(7)+" "+emis(8)+" >> "+emis(9)+" "+emis(10)+" "+emis(11)) >> >> asciiwrite("emisstring.txt",emis) >> asciiwrite("SD.txt",SD) >> >> system("./myscript.sh $(> >> end >> >> These two scripts are self-sufficient and you can easily copy-paste and >> test them on your system. Please let me know what's wrong here. >> >> Thanks a lot. >> >> Tabish >> ------------------------------- >> Dr Tabish Ansari >> Research Associate >> Air Quality Modelling Group >> IASS-Potsdam >> Germany >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Sat Oct 8 14:40:44 2022 From: shea at ucar.edu (Dennis Shea) Date: Sat, 8 Oct 2022 14:40:44 -0600 Subject: [ncl-talk] How to define date for WRF-chem to get average daily of a variable ? In-Reply-To: References: Message-ID: Attached is a modified version of your script. log(400/600) and integer divide (400/550) should be log(400.0/600.0) and 400.0/550.0 integer divide 400/600 and 400/550 yield 0s NOTE: A division using integer values 400/600 (both integers) does not create a fraction. I changed these to floats. ======================= It is **VERY IMPORTANT** for you to look at the dimensionality of variables. printVarSummary(a2) ; [Time | 8] x [bottom_top | 35] x [south_north | 199] x [west_east | 199] ===================== *calculate_daily_values * computes daily average; ; you have eight 3-hourly values for one day so the time dimension is dimension size 1 ==================== a2Day = calculate_daily_values (a2, "avg", 0, opt_cdv) printVarSummary(a2Day) ; [Time | 1] x [bottom_top | 35] x [south_north | 199] x [west_east | 199] ====================== I found the variable naming to be a bit confusing, AOD550_3D = a2Day * ((400./550.)^angstrom_exponent) ; changed from 400/550 ;AOD550_3D at long_name = "AOD550_3D" AOD550_3D at description = "AOD550_3D" copy_VarCoords(a2Day,AOD550_3D ) printVarSummary(AOD550_3D) ; [Time | 1] x [bottom_top | 35] x [south_north | 199] x [west_east | 199] The _3D implies (to me) that the variable is 3-dimensional. It is 4-dimensional =============== AOD550_2D = *dim_sum_n_Wrap*(AOD550_3D,0) ;AOD550_2D at long_name = "AOD550_2D" AOD550_2D at description = "AOD550_2D" printVarSummary(AOD550_2D) ; [bottom_top | 35] x [south_north | 199] x [west_east | 199] AOD550_2D is 3 dimensional not 2-dimension ================================================================ When the plot function is used, it expects 2-dimensional data but you were using a 3D array ;;plot = gsn_csm_contour_map(wks,AOD550_2D( ???,:,:),res) Maybe, instead of AOD550_2D = *dim_sum_n_Wrap*(AOD550_3D,0) ; sum the Time which is dimension 0 you wanted AOD550_2D = *dim_sum_n_Wrap*(AOD550_3D,1) ; 1 would mean all the levels [Time | 1] x [south_north | 199] x [west_east | 199] The plot c all would be plot = gsn_csm_contour_map(wks,AOD550_2D( 0,:,:),res) ; Time is dimension number 0 of AOD550_2D PLEASE look carefully at the code, the dimensionality and the results Good Luck On Sat, Oct 8, 2022 at 7:06 AM Setareh Rahimi wrote: > Dear Dennis, > I executed the script you send. It also worked for me. But may I ask you > please to execute the attached script? > Thanks in advance, > Best wishes, > > On Fri, Oct 7, 2022 at 10:57 PM Dennis Shea wrote: > >> Yes, I did "execute the entire script" I sent you. >> >> %> /project/cas/shea/WRF> ncl setareh_chem.ncl >! setareh_chem.OUTPUT >> ==================================== >> >> My script has no "x" >> >> I have no idea where or what the variable "x" is. >> >> Did you execute the script I sent you ? >> >> >> >> On Fri, Oct 7, 2022 at 1:02 PM Setareh Rahimi >> wrote: >> >>> Dear Dennis, >>> Did you execute the entire script? >>> Cause I still get errors! (attached) >>> >>> On Fri, Oct 7, 2022 at 9:31 PM Dennis Shea wrote: >>> >>>> My script follows.. There were no problems. The output is attached. >>>> >>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++ >>>> >>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" >>>> >>>> f = addfile("setareh_chem.nc","r") >>>> print(f) ; same as "nmcdump -h" >>>> >>>> Times = f->Times ; [Time | 41] x [DateStrLen | >>>> 19] (character) >>>> >>>> ; For fun: Examine "Times" in different formats >>>> >>>> Time_0 = wrf_times_c( Times, 0 ) ; "hours since" initial time on >>>> file (double) >>>> ; Time_0 >>>> is recognized by cd_calendar >>>> ;Time_1 = wrf_times_c( Times, 1 ) ; "hours since 1901-01-01 >>>> 00:00:00" (double) >>>> ;Time_2 = wrf_times_c( Times, 2 ) ; yyyymmddhhmnss >>>> (double) >>>> Time_3 = wrf_times_c( Times, 3 ) ; yyyymmddhh >>>> (integer) >>>> >>>> ;print(Times) >>>> ;print(Time_0) >>>> ;print(Time_1) >>>> ;print(Time_2) >>>> print(Time_3) ; easy on the eyes >>>> print("------------------------------------") >>>> >>>> a2 = f->TAUAER2 ; (Time, south_north, west_east) >>>> a2&Time = Time_0 ; associate the 'Time' >>>> coordinate with the variable using standard NCL & syntax >>>> printVarSummary(a2) >>>> print("------------------------------------") >>>> >>>> opt_cdv = True ; option for calculate_daily_values (cdv) >>>> opt_cdv at nval_crit = 4 ; default is 1 >>>> >>>> a2Day = calculate_daily_values (a2, "avg", 0, opt_cdv) >>>> printVarSummary(a2Day) >>>> printMinMax (a2Day,1) >>>> >>>> On Fri, Oct 7, 2022 at 9:28 AM Setareh Rahimi >>>> wrote: >>>> >>>>> Dear Dennis, >>>>> I sent you the file via transfer.pcloud.com. I could not send it here >>>>> due to the large size of the file. >>>>> Please check the script with the file and let me know your idea. >>>>> Many thanks for your help. >>>>> Best wishes, >>>>> >>>>> On Fri, Oct 7, 2022 at 3:18 PM Dennis Shea wrote: >>>>> >>>>>> I do not understand 'x' either >>>>>> >>>>>> "I wonder about variable x; I did not define such a variable." >>>>>> >>>>>> ncl 0> f = addfile(".....","r") ; I do not have your file >>>>>> ncl 1> print(f) ; like >>>>>> ncdump -h >>>>>> ncl 2> Times = f->Times ; Times(Time, >>>>>> DateStrLen) (type character) >>>>>> ncl 4> Time = wrf_times_c( Times, 0 ) ; "hours since" initial >>>>>> time on file (double); units recognized by cd_calendar >>>>>> ncl 5> print(Time) >>>>>> >>>>>> ncl 7> T = f->T >>>>>> ncl 8> printVarSummary(T) >>>>>> >>>>>> ncl 9> T&Time = Time ; associate time >>>>>> coordinate >>>>>> ncl 10> printVarSummary(T) >>>>>> >>>>>> Variable: T >>>>>> Type: float >>>>>> Total Size: 19683000 bytes >>>>>> 4920750 values >>>>>> Number of Dimensions: 4 >>>>>> Dimensions and sizes: [Time | ??] x [bottom_top | 27] x [south_north >>>>>> | 81] x [west_east | 90] >>>>>> Coordinates: >>>>>> Time: [ 0.. ?] >>>>>> Number Of Attributes: 5 >>>>>> FieldType : 104 >>>>>> MemoryOrder : XYZ >>>>>> description : perturbation potential temperature (theta-t0) >>>>>> units : K >>>>>> stagger : >>>>>> ncl 11> Tavg = calculate_daily_values (T, "avg", 0, True) >>>>>> ncl 12> printVarSummary(Tavg) >>>>>> >>>>>> Variable: Tavg >>>>>> Type: float >>>>>> Total Size: 1574640 bytes >>>>>> 393660 values >>>>>> Number of Dimensions: 4 >>>>>> Dimensions and sizes: [Time | ...] x [bottom_top | 27] x [south_north >>>>>> | 81] x [west_east | 90] >>>>>> Coordinates: >>>>>> Time: [ 0.. 12] >>>>>> Number Of Attributes: 8 >>>>>> _FillValue : 9.96921e+36 >>>>>> FieldType : 104 >>>>>> MemoryOrder : XYZ >>>>>> description : perturbation potential temperature (theta-t0) >>>>>> units : K >>>>>> stagger : >>>>>> Time : 0 >>>>>> NCL_tag : calculate_daily_values >>>>>> >>>>>> On Fri, Oct 7, 2022 at 5:16 AM Setareh Rahimi < >>>>>> setareh.rahimi at gmail.com> wrote: >>>>>> >>>>>>> Dear Dennis, >>>>>>> So many thanks for your advice. I made corrections to my script as >>>>>>> you suggested, and attempted to calculate and plot the average AOD for >>>>>>> 2011-06-28 but I still get errors. I attached the script and the errors. >>>>>>> >>>>>>> As you can see from the error message, NCL says :fatal: No >>>>>>> coordinate variable exists for dimension (Time) in variable (x) >>>>>>> I wonder about variable x; I did not define such a variable. >>>>>>> >>>>>>> Please advise me on how to sort this issue out. >>>>>>> Many thanks in advance, >>>>>>> Best wishes, >>>>>>> >>>>>>> On Fri, Oct 7, 2022 at 6:02 AM Dennis Shea wrote: >>>>>>> >>>>>>>> As noted in the documentation, *calculate_daily_values* >>>>>>>> >>>>>>>> requires that the variable have a **time coordinate** that is recognized by >>>>>>>> cd_calendar. >>>>>>>> >>>>>>>> Times = f->Times ; Times(Time, DateStrLen) (type character) >>>>>>>> Time = *wrf_times_c*( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar >>>>>>>> >>>>>>>> a2 = f->TAUAER ; (Time, south_north, west_east) >>>>>>>> a2&Time = Time ; associate the 'Time' coordinate with the >>>>>>>> variable using standard NCL & syntax >>>>>>>> printVarSummary(a2) >>>>>>>> print("------------------------------------") >>>>>>>> >>>>>>>> a2Day = calculate_daily_values (a2, "avg", 0, opt) >>>>>>>> printVarSummary(a2Day) >>>>>>>> printMinMax (a2Day,1) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Wed, Oct 5, 2022 at 9:30 AM Setareh Rahimi via ncl-talk < >>>>>>>> ncl-talk at mailman.ucar.edu> wrote: >>>>>>>> >>>>>>>>> Dear NCL users, >>>>>>>>> >>>>>>>>> I am trying to plot the daily average of AOD (aerosol optical >>>>>>>>> depth) from WRF-chem outputs. However, I can not define the time so that >>>>>>>>> NCL plots the daily average of AOD.(the script has been attached, and the >>>>>>>>> model output is too large and I just used ncdump to show the header of some >>>>>>>>> varibles ). >>>>>>>>> I tried the following commands: >>>>>>>>> >>>>>>>>> >>>>>>>>> times = wrf_user_getvar(f,"times",-1) >>>>>>>>> printVarSummary(times) >>>>>>>>> print(times) >>>>>>>>> ymdh = cd_calendar(a2×, -2) >>>>>>>>> print(ymdh) >>>>>>>>> >>>>>>>>> but faced an error. >>>>>>>>> Would you please kindly advise me on how can I calculate the daily >>>>>>>>> average of AOD from the hourly output of WRF-chem? >>>>>>>>> Many thanks in advance, >>>>>>>>> Best wishes, >>>>>>>>> -- >>>>>>>>> S.Rahimi >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> ncl-talk mailing list >>>>>>>>> ncl-talk at mailman.ucar.edu >>>>>>>>> List instructions, subscriber options, unsubscribe: >>>>>>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>>>>>>> >>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> S.Rahimi >>>>>>> >>>>>>> >>>>> >>>>> -- >>>>> S.Rahimi >>>>> >>>>> >>> >>> -- >>> S.Rahimi >>> >>> > > -- > S.Rahimi > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: seteareh.test.ncl Type: application/octet-stream Size: 5644 bytes Desc: not available URL: From kunal.bali9 at gmail.com Wed Oct 12 20:35:07 2022 From: kunal.bali9 at gmail.com (Kunal Bali) Date: Wed, 12 Oct 2022 18:35:07 -0800 Subject: [ncl-talk] generic to rectilinear Message-ID: Hi, I am trying to convert the generic gridtype to rectilinear by using the attached script. But, I am facing some error as. "fatal:Number of dimensions in parameter (1) of (rectilinear_to_SCRIP) is (2), (1) dimensions were expected fatal:["Execute.c":8637]:Execute: Error occurred at or near line 21 in file courv_rect.ncl" Please let me know how to sort out this issue. The file and script are attached. The attached file is converted from .he5 to nc4 via NCO. Thanks --- Kunal Bali -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: file_01.nc.zip Type: application/zip Size: 462033 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: courv_rect.ncl Type: application/octet-stream Size: 528 bytes Desc: not available URL: From kunal.bali9 at gmail.com Thu Oct 13 01:16:43 2022 From: kunal.bali9 at gmail.com (Kunal Bali) Date: Wed, 12 Oct 2022 23:16:43 -0800 Subject: [ncl-talk] assign coordinates In-Reply-To: References: Message-ID: Hi, Please ignore the the previous email. I have sorted it out. Thanks --- Kunal On Tue, 11 Oct 2022 at 17:48, Kunal Bali wrote: > Hi, > > I want to convert the attached .he5 file to .nc format. > Could anyone tell me how I can do that? > > However, I tried and convert it into .nc4 but the output (file2.nc, > attached) came as generic coordinates. So can I assign > georeferenced coordinates (2D to Geo2D) to this file (file2.nc)? I tried > it but could not able to do that. > > Please let me know if you have any ideas. > > > Thanks > > > > --- > Kunal > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From setareh.rahimi at gmail.com Thu Oct 13 01:43:21 2022 From: setareh.rahimi at gmail.com (Setareh Rahimi) Date: Thu, 13 Oct 2022 11:13:21 +0330 Subject: [ncl-talk] How to define date for WRF-chem to get average daily of a variable ? In-Reply-To: References: Message-ID: Dear Dennis, So many thanks for your help and advice. Yes you're right I need AOD550_2D = *dim_sum_n_Wrap*(AOD550_3D,1) to sum over all layers. I appreciate the time you consider to modify the script. Best wishes, On Sun, Oct 9, 2022 at 12:10 AM Dennis Shea wrote: > Attached is a modified version of your script. > > log(400/600) and integer divide (400/550) should be log(400.0/600.0) and > 400.0/550.0 > integer divide 400/600 and 400/550 yield 0s > > NOTE: A division using integer values 400/600 (both integers) does not > create a fraction. > > I changed these to floats. > ======================= > > It is **VERY IMPORTANT** for you to look at the dimensionality of > variables. > > printVarSummary(a2) ; [Time | 8] x [bottom_top | 35] x > [south_north | 199] x [west_east | 199] > ===================== > *calculate_daily_values * > computes > daily average; > ; you have eight 3-hourly values for one day so the time dimension is > dimension size 1 > ==================== > a2Day = calculate_daily_values (a2, "avg", 0, opt_cdv) > printVarSummary(a2Day) ; [Time | 1] x [bottom_top | 35] x > [south_north | 199] x [west_east | 199] > ====================== > I found the variable naming to be a bit confusing, > > AOD550_3D = a2Day * ((400./550.)^angstrom_exponent) ; changed from > 400/550 > ;AOD550_3D at long_name = "AOD550_3D" > AOD550_3D at description = "AOD550_3D" > copy_VarCoords(a2Day,AOD550_3D ) > printVarSummary(AOD550_3D) ; [Time | 1] x [bottom_top | 35] x > [south_north | 199] x [west_east | 199] > > The _3D implies (to me) that the variable is 3-dimensional. > It is 4-dimensional > =============== > AOD550_2D = *dim_sum_n_Wrap*(AOD550_3D,0) > ;AOD550_2D at long_name = "AOD550_2D" > AOD550_2D at description = "AOD550_2D" > printVarSummary(AOD550_2D) ; [bottom_top | 35] x [south_north | > 199] x [west_east | 199] > > AOD550_2D is 3 dimensional not 2-dimension > ================================================================ > > When the plot function is used, it expects 2-dimensional data but you were > using a 3D array > > ;;plot = gsn_csm_contour_map(wks,AOD550_2D( ???,:,:),res) > > > Maybe, instead of > AOD550_2D = *dim_sum_n_Wrap*(AOD550_3D,0) ; sum the Time which is > dimension 0 > you wanted > > AOD550_2D = *dim_sum_n_Wrap*(AOD550_3D,1) ; 1 would mean all the levels > [Time | 1] x [south_north | 199] x [west_east | 199] > > The plot c all would be > > plot = gsn_csm_contour_map(wks,AOD550_2D( 0,:,:),res) ; Time is dimension > number 0 of AOD550_2D > > PLEASE look carefully at the code, the dimensionality and the results > > Good Luck > > On Sat, Oct 8, 2022 at 7:06 AM Setareh Rahimi > wrote: > >> Dear Dennis, >> I executed the script you send. It also worked for me. But may I ask you >> please to execute the attached script? >> Thanks in advance, >> Best wishes, >> >> On Fri, Oct 7, 2022 at 10:57 PM Dennis Shea wrote: >> >>> Yes, I did "execute the entire script" I sent you. >>> >>> %> /project/cas/shea/WRF> ncl setareh_chem.ncl >! setareh_chem.OUTPUT >>> ==================================== >>> >>> My script has no "x" >>> >>> I have no idea where or what the variable "x" is. >>> >>> Did you execute the script I sent you ? >>> >>> >>> >>> On Fri, Oct 7, 2022 at 1:02 PM Setareh Rahimi >>> wrote: >>> >>>> Dear Dennis, >>>> Did you execute the entire script? >>>> Cause I still get errors! (attached) >>>> >>>> On Fri, Oct 7, 2022 at 9:31 PM Dennis Shea wrote: >>>> >>>>> My script follows.. There were no problems. The output is attached. >>>>> >>>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++ >>>>> >>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" >>>>> >>>>> f = addfile("setareh_chem.nc","r") >>>>> print(f) ; same as "nmcdump -h" >>>>> >>>>> Times = f->Times ; [Time | 41] x [DateStrLen | >>>>> 19] (character) >>>>> >>>>> ; For fun: Examine "Times" in different formats >>>>> >>>>> Time_0 = wrf_times_c( Times, 0 ) ; "hours since" initial time >>>>> on file (double) >>>>> ; Time_0 >>>>> is recognized by cd_calendar >>>>> ;Time_1 = wrf_times_c( Times, 1 ) ; "hours since 1901-01-01 >>>>> 00:00:00" (double) >>>>> ;Time_2 = wrf_times_c( Times, 2 ) ; yyyymmddhhmnss >>>>> (double) >>>>> Time_3 = wrf_times_c( Times, 3 ) ; yyyymmddhh >>>>> (integer) >>>>> >>>>> ;print(Times) >>>>> ;print(Time_0) >>>>> ;print(Time_1) >>>>> ;print(Time_2) >>>>> print(Time_3) ; easy on the eyes >>>>> print("------------------------------------") >>>>> >>>>> a2 = f->TAUAER2 ; (Time, south_north, >>>>> west_east) >>>>> a2&Time = Time_0 ; associate the 'Time' >>>>> coordinate with the variable using standard NCL & syntax >>>>> printVarSummary(a2) >>>>> print("------------------------------------") >>>>> >>>>> opt_cdv = True ; option for calculate_daily_values (cdv) >>>>> opt_cdv at nval_crit = 4 ; default is 1 >>>>> >>>>> a2Day = calculate_daily_values (a2, "avg", 0, opt_cdv) >>>>> printVarSummary(a2Day) >>>>> printMinMax (a2Day,1) >>>>> >>>>> On Fri, Oct 7, 2022 at 9:28 AM Setareh Rahimi < >>>>> setareh.rahimi at gmail.com> wrote: >>>>> >>>>>> Dear Dennis, >>>>>> I sent you the file via transfer.pcloud.com. I could not send it >>>>>> here due to the large size of the file. >>>>>> Please check the script with the file and let me know your idea. >>>>>> Many thanks for your help. >>>>>> Best wishes, >>>>>> >>>>>> On Fri, Oct 7, 2022 at 3:18 PM Dennis Shea wrote: >>>>>> >>>>>>> I do not understand 'x' either >>>>>>> >>>>>>> "I wonder about variable x; I did not define such a variable." >>>>>>> >>>>>>> ncl 0> f = addfile(".....","r") ; I do not have your file >>>>>>> ncl 1> print(f) ; like >>>>>>> ncdump -h >>>>>>> ncl 2> Times = f->Times ; Times(Time, >>>>>>> DateStrLen) (type character) >>>>>>> ncl 4> Time = wrf_times_c( Times, 0 ) ; "hours since" initial >>>>>>> time on file (double); units recognized by cd_calendar >>>>>>> ncl 5> print(Time) >>>>>>> >>>>>>> ncl 7> T = f->T >>>>>>> ncl 8> printVarSummary(T) >>>>>>> >>>>>>> ncl 9> T&Time = Time ; associate time >>>>>>> coordinate >>>>>>> ncl 10> printVarSummary(T) >>>>>>> >>>>>>> Variable: T >>>>>>> Type: float >>>>>>> Total Size: 19683000 bytes >>>>>>> 4920750 values >>>>>>> Number of Dimensions: 4 >>>>>>> Dimensions and sizes: [Time | ??] x [bottom_top | 27] x [south_north >>>>>>> | 81] x [west_east | 90] >>>>>>> Coordinates: >>>>>>> Time: [ 0.. ?] >>>>>>> Number Of Attributes: 5 >>>>>>> FieldType : 104 >>>>>>> MemoryOrder : XYZ >>>>>>> description : perturbation potential temperature (theta-t0) >>>>>>> units : K >>>>>>> stagger : >>>>>>> ncl 11> Tavg = calculate_daily_values (T, "avg", 0, True) >>>>>>> ncl 12> printVarSummary(Tavg) >>>>>>> >>>>>>> Variable: Tavg >>>>>>> Type: float >>>>>>> Total Size: 1574640 bytes >>>>>>> 393660 values >>>>>>> Number of Dimensions: 4 >>>>>>> Dimensions and sizes: [Time | ...] x [bottom_top | 27] x >>>>>>> [south_north | 81] x [west_east | 90] >>>>>>> Coordinates: >>>>>>> Time: [ 0.. 12] >>>>>>> Number Of Attributes: 8 >>>>>>> _FillValue : 9.96921e+36 >>>>>>> FieldType : 104 >>>>>>> MemoryOrder : XYZ >>>>>>> description : perturbation potential temperature (theta-t0) >>>>>>> units : K >>>>>>> stagger : >>>>>>> Time : 0 >>>>>>> NCL_tag : calculate_daily_values >>>>>>> >>>>>>> On Fri, Oct 7, 2022 at 5:16 AM Setareh Rahimi < >>>>>>> setareh.rahimi at gmail.com> wrote: >>>>>>> >>>>>>>> Dear Dennis, >>>>>>>> So many thanks for your advice. I made corrections to my script as >>>>>>>> you suggested, and attempted to calculate and plot the average AOD for >>>>>>>> 2011-06-28 but I still get errors. I attached the script and the errors. >>>>>>>> >>>>>>>> As you can see from the error message, NCL says :fatal: No >>>>>>>> coordinate variable exists for dimension (Time) in variable (x) >>>>>>>> I wonder about variable x; I did not define such a variable. >>>>>>>> >>>>>>>> Please advise me on how to sort this issue out. >>>>>>>> Many thanks in advance, >>>>>>>> Best wishes, >>>>>>>> >>>>>>>> On Fri, Oct 7, 2022 at 6:02 AM Dennis Shea wrote: >>>>>>>> >>>>>>>>> As noted in the documentation, *calculate_daily_values* >>>>>>>>> >>>>>>>>> requires that the variable have a **time coordinate** that is recognized by >>>>>>>>> cd_calendar. >>>>>>>>> >>>>>>>>> Times = f->Times ; Times(Time, DateStrLen) (type character) >>>>>>>>> Time = *wrf_times_c*( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar >>>>>>>>> >>>>>>>>> a2 = f->TAUAER ; (Time, south_north, west_east) >>>>>>>>> a2&Time = Time ; associate the 'Time' coordinate with the >>>>>>>>> variable using standard NCL & syntax >>>>>>>>> printVarSummary(a2) >>>>>>>>> print("------------------------------------") >>>>>>>>> >>>>>>>>> a2Day = calculate_daily_values (a2, "avg", 0, opt) >>>>>>>>> printVarSummary(a2Day) >>>>>>>>> printMinMax (a2Day,1) >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Wed, Oct 5, 2022 at 9:30 AM Setareh Rahimi via ncl-talk < >>>>>>>>> ncl-talk at mailman.ucar.edu> wrote: >>>>>>>>> >>>>>>>>>> Dear NCL users, >>>>>>>>>> >>>>>>>>>> I am trying to plot the daily average of AOD (aerosol optical >>>>>>>>>> depth) from WRF-chem outputs. However, I can not define the time so that >>>>>>>>>> NCL plots the daily average of AOD.(the script has been attached, and the >>>>>>>>>> model output is too large and I just used ncdump to show the header of some >>>>>>>>>> varibles ). >>>>>>>>>> I tried the following commands: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> times = wrf_user_getvar(f,"times",-1) >>>>>>>>>> printVarSummary(times) >>>>>>>>>> print(times) >>>>>>>>>> ymdh = cd_calendar(a2×, -2) >>>>>>>>>> print(ymdh) >>>>>>>>>> >>>>>>>>>> but faced an error. >>>>>>>>>> Would you please kindly advise me on how can I calculate the >>>>>>>>>> daily average of AOD from the hourly output of WRF-chem? >>>>>>>>>> Many thanks in advance, >>>>>>>>>> Best wishes, >>>>>>>>>> -- >>>>>>>>>> S.Rahimi >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> ncl-talk mailing list >>>>>>>>>> ncl-talk at mailman.ucar.edu >>>>>>>>>> List instructions, subscriber options, unsubscribe: >>>>>>>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> S.Rahimi >>>>>>>> >>>>>>>> >>>>>> >>>>>> -- >>>>>> S.Rahimi >>>>>> >>>>>> >>>> >>>> -- >>>> S.Rahimi >>>> >>>> >> >> -- >> S.Rahimi >> >> -- S.Rahimi -------------- next part -------------- An HTML attachment was scrubbed... URL: From g.graffino at tim.it Thu Oct 13 10:38:04 2022 From: g.graffino at tim.it (Giorgio Graffino) Date: Thu, 13 Oct 2022 18:38:04 +0200 (CEST) Subject: [ncl-talk] regCoef_n without y-axis intercept Message-ID: <49de638c.56132.183d235ca92.Webtop.42@tim.it> Hi NCL community, I want regCoef_n to find the regression coefficient between two arrays without y-axis intercept. Do you know how I can change the function to do that? Can you also please tell me where I can find the function? I did a grep recursive search in my $NCARG_ROOT directory but I couldn't find it. Cheers, Giorgio -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.allured at noaa.gov Thu Oct 13 10:47:40 2022 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Thu, 13 Oct 2022 10:47:40 -0600 Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: <49de638c.56132.183d235ca92.Webtop.42@tim.it> References: <49de638c.56132.183d235ca92.Webtop.42@tim.it> Message-ID: Giorgio, for your second question, please see this very brief description that I recently wrote, for how to search for functions in the NCL source code. https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi NCL community, > > I want regCoef_n to find the regression coefficient between two arrays > without y-axis intercept. Do you know how I can change the function to do > that? > > Can you also please tell me where I can find the function? I did a grep > recursive search in my $NCARG_ROOT directory but I couldn't find it. > > Cheers, > > Giorgio > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ehsantaghizadeh at yahoo.com Sat Oct 15 09:10:59 2022 From: ehsantaghizadeh at yahoo.com (Ehsan Taghizadeh) Date: Sat, 15 Oct 2022 15:10:59 +0000 (UTC) Subject: [ncl-talk] := or = References: <55987309.1438529.1665846659167.ref@mail.yahoo.com> Message-ID: <55987309.1438529.1665846659167@mail.yahoo.com> Hi,I faced something interesting which I didn?t know in NCL. It might be obvious for many of you, however, I would like to share it.I tried to plot wind barb at 10m level above the ground from GFS0.25 data. First, I used following lines: u10 = fi->UGRD_P0_L103_GLL0({10},:,:) v10 = fi->VGRD_P0_L103_GLL0({10},:,:) u10 := u10*1.94386 ; Turn wind into knots v10 := v10*1.94386 u10 at units = "kts" v10 at units = "kts"The resulted map was something like plt1 which is wrong.Then I tried to use the following lines: u10 = u10*1.94386 ; Turn wind into knots v10 = v10*1.94386This turn the resulted map (plt2) was correct.I?ll be thankful if some one could explain me why using ?:=? is false and using ?=? is true in this situation. -----------------------------------------------------------------------------Sincerely,Ehsan Taghizadeh -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: plt1.png Type: image/png Size: 347352 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: plt2.png Type: image/png Size: 312168 bytes Desc: not available URL: From dave.allured at noaa.gov Sat Oct 15 10:08:41 2022 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Sat, 15 Oct 2022 10:08:41 -0600 Subject: [ncl-talk] := or = In-Reply-To: <55987309.1438529.1665846659167@mail.yahoo.com> References: <55987309.1438529.1665846659167.ref@mail.yahoo.com> <55987309.1438529.1665846659167@mail.yahoo.com> Message-ID: Ehsan, := is called the "reassignment operator". It completely deletes the variable on the left, if any, before assigning the new array value. The normal assignment operator "=" does not do this. It replaces only the numeric values, and preserves any metadata on the left Now consider that an assignment like b = a*b, or b := a*b, is evaluated in two separate stages. First the right side is evaluated. Then the result is copied to the left side. Also, any math expression like a*b removes all metadata from the input arrays, including coordinates and dimension names. Therefore: * With b = a*b, only the numeric values in b are replaced, and previous metadata on b is left intact. * With b := a*b, b is deleted after calculation, and before assignment. A brand new array for b is calculated, and all previous metadata on b is lost. There are several consecutive sections covering this in the NCL users manual, starting with "Variable Assignment". On Sat, Oct 15, 2022 at 9:11 AM Ehsan Taghizadeh via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi, > I faced something interesting which I didn?t know in NCL. It might be > obvious for many of you, however, I would like to share it. > I tried to plot wind barb at 10m level above the ground from GFS0.25 data. > First, I used following lines: > u10 = fi->UGRD_P0_L103_GLL0({10},:,:) > v10 = fi->VGRD_P0_L103_GLL0({10},:,:) > u10 := u10*1.94386 ; Turn wind into knots > v10 := v10*1.94386 > u10 at units = "kts" > v10 at units = "kts" > The resulted map was something like plt1 which is wrong. > Then I tried to use the following lines: > u10 = u10*1.94386 ; Turn wind into knots > v10 = v10*1.94386 > This turn the resulted map (plt2) was correct. > I?ll be thankful if some one could explain me why using ?:=? is false and > using ?=? is true in this situation. > > *-----------------------------------------------------------------------------* > *Sincerely,* > *Ehsan Taghizadeh* > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jayantkp2979 at gmail.com Mon Oct 17 18:40:16 2022 From: jayantkp2979 at gmail.com (Jayant) Date: Mon, 17 Oct 2022 21:40:16 -0300 Subject: [ncl-talk] returning value to the shell Message-ID: Hi! I have a shell script to start with where some variables (year, month,tstep,variable name) are defined and passed to a ncl script. Next, the ncl script performs further analysis (reading variables, analyzing). The dimensionality (2-d or 3-d or 4-d) of the variable is determined inside the ncl script, but I need this information back in the shell script. Is it possible to get it? Roughly, I tried this ---------------------- myscript.ncl yr=toint(getenv("YEAR")) mn=toint(getenv("MON")) varin=getenv("VNAME") ... finp=addfile("modelout_"+yr+"_"+mn+".bin","r") vinp=finp->varin ... vdimin=dimsizes(varin) *system("export VDIMS="+vdimin) ; is it the correct way?* ... ---------------------- run_ncl.sh #!/bin/sh export YEAR=2019 export MON=8 export TSTEP=6 export VNAME="PREC" ncl myscript.ncl *echo $VDIMS ; returning empty ???* ----------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From brownrig at ucar.edu Mon Oct 17 20:18:12 2022 From: brownrig at ucar.edu (Rick Brownrigg) Date: Mon, 17 Oct 2022 20:18:12 -0600 Subject: [ncl-talk] returning value to the shell In-Reply-To: References: Message-ID: HI Jayant, I don't think that is going to work. There's a hierarchy of system processes going on there: your outer shell process, which invokes ncl as a process, which in turn invokes an "inner" shell process with the system() command. The environment variable gets set in that inner process, which promptly terminates. There's no way to pass environment settings back up the hierarchy that I am aware of. I'm not a bash wizard, but what comes to mind is to write a file from ncl, and have your outer shell read that. So for example, print() the values you need and invoke ncl as: ncl -nQ myscript.ncl >myvars.txt. (the -n keeps ncl from enumerating its output lines, and the -Q keeps it from printing the copyright stuff) Then do something in your bash script similar to that described with this link: https://www.cyberciti.biz/faq/unix-howto-read-line-by-line-from-file/ I hope that helps... Rick On Mon, Oct 17, 2022 at 6:40 PM Jayant via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi! > I have a shell script to start with where some variables (year, > month,tstep,variable name) are defined and passed to a ncl script. Next, > the ncl script performs further analysis (reading variables, analyzing). > The dimensionality (2-d or 3-d or 4-d) of the variable is determined inside > the ncl script, but I need this information back in the shell script. Is it > possible to get it? Roughly, I tried this > ---------------------- > myscript.ncl > yr=toint(getenv("YEAR")) > mn=toint(getenv("MON")) > varin=getenv("VNAME") > ... > finp=addfile("modelout_"+yr+"_"+mn+".bin","r") > vinp=finp->varin > ... > vdimin=dimsizes(varin) > > *system("export VDIMS="+vdimin) ; is it the correct way?* > ... > ---------------------- > run_ncl.sh > #!/bin/sh > export YEAR=2019 > export MON=8 > export TSTEP=6 > export VNAME="PREC" > > ncl myscript.ncl > > *echo $VDIMS ; returning empty ???* > ----------------------------- > > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jayantkp2979 at gmail.com Mon Oct 17 20:31:19 2022 From: jayantkp2979 at gmail.com (Jayant) Date: Mon, 17 Oct 2022 23:31:19 -0300 Subject: [ncl-talk] returning value to the shell In-Reply-To: References: Message-ID: Hi Rick, Thank you for the explanation. I will look into the suggested link. Best regards, Jayant On Mon, Oct 17, 2022 at 11:18 PM Rick Brownrigg wrote: > HI Jayant, > > I don't think that is going to work. There's a hierarchy of system > processes going on there: your outer shell process, which invokes ncl as a > process, which in turn invokes an "inner" shell process with the system() > command. The environment variable gets set in that inner process, which > promptly terminates. There's no way to pass environment settings back up > the hierarchy that I am aware of. > > I'm not a bash wizard, but what comes to mind is to write a file from ncl, > and have your outer shell read that. So for example, print() the values you > need and invoke ncl as: > > ncl -nQ myscript.ncl >myvars.txt. (the -n keeps ncl from enumerating > its output lines, and the -Q keeps it from printing the copyright stuff) > > Then do something in your bash script similar to that described with this > link: > > https://www.cyberciti.biz/faq/unix-howto-read-line-by-line-from-file/ > > I hope that helps... > Rick > > > > > On Mon, Oct 17, 2022 at 6:40 PM Jayant via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hi! >> I have a shell script to start with where some variables (year, >> month,tstep,variable name) are defined and passed to a ncl script. Next, >> the ncl script performs further analysis (reading variables, analyzing). >> The dimensionality (2-d or 3-d or 4-d) of the variable is determined inside >> the ncl script, but I need this information back in the shell script. Is it >> possible to get it? Roughly, I tried this >> ---------------------- >> myscript.ncl >> yr=toint(getenv("YEAR")) >> mn=toint(getenv("MON")) >> varin=getenv("VNAME") >> ... >> finp=addfile("modelout_"+yr+"_"+mn+".bin","r") >> vinp=finp->varin >> ... >> vdimin=dimsizes(varin) >> >> *system("export VDIMS="+vdimin) ; is it the correct way?* >> ... >> ---------------------- >> run_ncl.sh >> #!/bin/sh >> export YEAR=2019 >> export MON=8 >> export TSTEP=6 >> export VNAME="PREC" >> >> ncl myscript.ncl >> >> *echo $VDIMS ; returning empty ???* >> ----------------------------- >> >> >> _______________________________________________ >> ncl-talk mailing list >> ncl-talk at mailman.ucar.edu >> List instructions, subscriber options, unsubscribe: >> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zoejacobs1990 at gmail.com Tue Oct 18 01:02:51 2022 From: zoejacobs1990 at gmail.com (zoe jacobs) Date: Tue, 18 Oct 2022 10:32:51 +0330 Subject: [ncl-talk] aerosol_index_340_380 from Sentinel 5p Message-ID: Dear all NCL users, I am new in NCL, and need to plot a map using Sentinel 5p data. The variable I need to draw is aerosol_index_340_380. How can I achieve this, please? The file has been attached. S5p.zip -------------- next part -------------- An HTML attachment was scrubbed... URL: From debasish.hazra5 at gmail.com Tue Oct 18 14:38:30 2022 From: debasish.hazra5 at gmail.com (Debasish Hazra) Date: Tue, 18 Oct 2022 16:38:30 -0400 Subject: [ncl-talk] script to get data Message-ID: Does anyone know or share script that downloads data from AERONET site on a routine basis. Appreciate your help. Thanks Debasish -------------- next part -------------- An HTML attachment was scrubbed... URL: From g.graffino at tim.it Thu Oct 20 09:52:52 2022 From: g.graffino at tim.it (Giorgio Graffino) Date: Thu, 20 Oct 2022 17:52:52 +0200 (CEST) Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: <49de638c.56132.183d235ca92.Webtop.42@tim.it> References: <49de638c.56132.183d235ca92.Webtop.42@tim.it> Message-ID: <3451bddb.6b911.183f618eed1.Webtop.50@tim.it> Hi Dave, Thanks for the advice. I looked at the examples in https://www.ncl.ucar.edu/Applications/regress.shtml, especially examples 2 and 4, but I couldn't find any supplementary information about regCoef. I also can't find anything under $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please point me where it is? Cheers, Giorgio ------ Messaggio Originale ------ Da: dave.allured at noaa.gov A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: gioved? 13 ottobre 2022 18:47 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept Giorgio, for your second question, please see this very brief description that I recently wrote, for how to search for functions in the NCL source code. https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk > wrote: Hi NCL community, I want regCoef_n to find the regression coefficient between two arrays without y-axis intercept. Do you know how I can change the function to do that? Can you also please tell me where I can find the function? I did a grep recursive search in my $NCARG_ROOT directory but I couldn't find it. Cheers, Giorgio -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.allured at noaa.gov Thu Oct 20 10:52:35 2022 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Thu, 20 Oct 2022 10:52:35 -0600 Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: <3451bddb.6b911.183f618eed1.Webtop.50@tim.it> References: <49de638c.56132.183d235ca92.Webtop.42@tim.it> <3451bddb.6b911.183f618eed1.Webtop.50@tim.it> Message-ID: Giorgio, NCL source code is not located within $NCARG_ROOT. You must either download the full source code archive, or browse the NCL Github repository. For links, please follow the Download link in the header bar on the main NCL website. You will need to link through a second "Install" page, and read down a ways. On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino wrote: > Hi Dave, > > Thanks for the advice. I looked at the examples in > https://www.ncl.ucar.edu/Applications/regress.shtml, especially examples > 2 and 4, but I couldn't find any supplementary information about regCoef. I > also can't find anything under > $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and > $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. > > Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please > point me where it is? > > Cheers, > > Giorgio > > > ------ Messaggio Originale ------ > Da: dave.allured at noaa.gov > A: g.graffino at tim.it > Cc: ncl-talk at ucar.edu > Inviato: gioved? 13 ottobre 2022 18:47 > Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept > > Giorgio, for your second question, please see this very brief description > that I recently wrote, for how to search for functions in the NCL source > code. > https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html > > > On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hi NCL community, >> >> I want regCoef_n to find the regression coefficient between two arrays >> without y-axis intercept. Do you know how I can change the function to do >> that? >> >> Can you also please tell me where I can find the function? I did a grep >> recursive search in my $NCARG_ROOT directory but I couldn't find it. >> >> Cheers, >> >> Giorgio >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Thu Oct 20 11:17:04 2022 From: shea at ucar.edu (Dennis Shea) Date: Thu, 20 Oct 2022 11:17:04 -0600 Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: <3451bddb.6b911.183f618eed1.Webtop.50@tim.it> References: <49de638c.56132.183d235ca92.Webtop.42@tim.it> <3451bddb.6b911.183f618eed1.Webtop.50@tim.it> Message-ID: The f77 code is attached. On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi Dave, > > > Thanks for the advice. I looked at the examples in > https://www.ncl.ucar.edu/Applications/regress.shtml, especially examples > 2 and 4, but I couldn't find any supplementary information about regCoef. I > also can't find anything under > $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and > $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. > > > Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please > point me where it is? > > > Cheers, > > Giorgio > > > > ------ Messaggio Originale ------ > Da: dave.allured at noaa.gov > A: g.graffino at tim.it > Cc: ncl-talk at ucar.edu > Inviato: gioved? 13 ottobre 2022 18:47 > Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept > > Giorgio, for your second question, please see this very brief description > that I recently wrote, for how to search for functions in the NCL source > code. > https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html > > > On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hi NCL community, >> >> I want regCoef_n to find the regression coefficient between two arrays >> without y-axis intercept. Do you know how I can change the function to do >> that? >> >> Can you also please tell me where I can find the function? I did a grep >> recursive search in my $NCARG_ROOT directory but I couldn't find it. >> >> Cheers, >> >> Giorgio >> > > > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: regcoef_dp.f Type: application/octet-stream Size: 4397 bytes Desc: not available URL: From g.graffino at tim.it Fri Oct 21 05:14:24 2022 From: g.graffino at tim.it (Giorgio Graffino) Date: Fri, 21 Oct 2022 13:14:24 +0200 (CEST) Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: <3451bddb.6b911.183f618eed1.Webtop.50@tim.it> References: <3451bddb.6b911.183f618eed1.Webtop.50@tim.it> Message-ID: <22f4c20.658c3.183fa40580e.Webtop.68@tim.it> Hi Dennis, Dave Thanks for sending the relevant function and for explaining how to access the source code. Now I'm thinking how to make the function to force the regression to pass from origin. Any idea on how to do that? Cheers, Giorgio ------ Messaggio Originale ------ Da: shea at ucar.edu A: g.graffino at tim.it Cc: dave.allured at noaa.gov; ncl-talk at ucar.edu Inviato: gioved? 20 ottobre 2022 19:17 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept The f77 code is attached. On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino via ncl-talk > wrote: Hi Dave, Thanks for the advice. I looked at the examples in https://www.ncl.ucar.edu/Applications/regress.shtml , especially examples 2 and 4, but I couldn't find any supplementary information about regCoef. I also can't find anything under $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please point me where it is? Cheers, Giorgio ------ Messaggio Originale ------ Da: dave.allured at noaa.gov A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: gioved? 13 ottobre 2022 18:47 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept Giorgio, for your second question, please see this very brief description that I recently wrote, for how to search for functions in the NCL source code. https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk > wrote: Hi NCL community, I want regCoef_n to find the regression coefficient between two arrays without y-axis intercept. Do you know how I can change the function to do that? Can you also please tell me where I can find the function? I did a grep recursive search in my $NCARG_ROOT directory but I couldn't find it. Cheers, Giorgio _______________________________________________ ncl-talk mailing list ncl-talk at mailman.ucar.edu List instructions, subscriber options, unsubscribe: https://mailman.ucar.edu/mailman/listinfo/ncl-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From kunal.bali9 at gmail.com Fri Oct 21 19:27:28 2022 From: kunal.bali9 at gmail.com (Kunal Bali) Date: Fri, 21 Oct 2022 17:27:28 -0800 Subject: [ncl-talk] merge all the files into one Message-ID: Dear NCL users, I like to merge or concatenate all the attached .nc files into one file. I tried with NCO/CDO but was not able to do that. Every file has a curvilinear grid projection. Therefore, with CDO/NCO becomes difficult to merge/concatenate all the files into one file. Could anyone please let me know how to do that? https://www.dropbox.com/s/978vyxtttutwcq0/Archive.zip?dl=0 --- Kunal -------------- next part -------------- An HTML attachment was scrubbed... URL: From jpclark186000 at gmail.com Sat Oct 22 15:26:32 2022 From: jpclark186000 at gmail.com (Joseph Clark) Date: Sat, 22 Oct 2022 17:26:32 -0400 Subject: [ncl-talk] Suppress "attempt to fix non-monotonic aggregation variable" Message-ID: Hi NCL users, I am using NCL version 6.3.0. I have a line like, *variable = ncfile[:]->varname* I get the following error, *warning:error attempting to fix non-monotonic aggregation variable* I understand exactly what the error is saying, but I do not want the concatenation to change the ordering of the leftmost dimension. It is the correct order. I know I could make a change to the netcdf files to have a time array and time unit that NCL understands is proper order. * However, it would be simplest if NCL did not "attempt to fix non-monotonic aggregation variable" opting instead to ignore what the order of the time array is. Is there a way to tell NCL to ignore the non-monotonicity? * Thanks! Joe -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Sun Oct 23 13:01:03 2022 From: shea at ucar.edu (Dennis Shea) Date: Sun, 23 Oct 2022 13:01:03 -0600 Subject: [ncl-talk] Suppress "attempt to fix non-monotonic aggregation variable" In-Reply-To: References: Message-ID: x("time/record",[level, latitude,longitude) I speculate that NCL's developers were trying to prevent a user from 'shooting themselves in the foot' I an not aware any option to disable this 'feature' of NCL ================== ***Possibly:*** Non-NCL *Climate Data Operators* *https://www.unidata.ucar.edu/software/netcdf/workshops/2012/third_party/CDO.html* %> cdo cat *.nc out.nc ========== *netCDF Operators* see *ncrcat *examples On Sat, Oct 22, 2022 at 3:26 PM Joseph Clark via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi NCL users, > > I am using NCL version 6.3.0. I have a line like, > > *variable = ncfile[:]->varname* > > I get the following error, > > > > *warning:error attempting to fix non-monotonic aggregation variable* > I understand exactly what the error is saying, but I do not want the > concatenation to change the ordering of the leftmost dimension. It is the > correct order. I know I could make a change to the netcdf files to have a > time array and time unit that NCL understands is proper order. > > * However, it would be simplest if NCL did not "attempt to fix > non-monotonic aggregation variable" opting instead to ignore what the order > of the time array is. Is there a way to tell NCL to ignore the > non-monotonicity? * > Thanks! > > Joe > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.allured at noaa.gov Sun Oct 23 15:39:42 2022 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Sun, 23 Oct 2022 15:39:42 -0600 Subject: [ncl-talk] Suppress "attempt to fix non-monotonic aggregation variable" In-Reply-To: References: Message-ID: Joe, that error comes out of the automatic aggregation feature of addfiles "cat" mode (concatenate). Addfiles also has a "join" mode which handles dimensions differently, and does not do coordinate aggregation. Read about that in function docs for addfiles and ListSetType. There are examples in both function docs. Will join mode work for your application? On Sun, Oct 23, 2022 at 1:01 PM Dennis Shea via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > x("time/record",[level, latitude,longitude) > > I speculate that NCL's developers were trying to prevent a user from > 'shooting themselves in the foot' > I an not aware any option to disable this 'feature' of NCL > > ================== > > ***Possibly:*** Non-NCL > > *Climate Data Operators* > > *https://www.unidata.ucar.edu/software/netcdf/workshops/2012/third_party/CDO.html* > > > %> cdo cat *.nc out.nc > > ========== > *netCDF Operators* > see *ncrcat *examples > > On Sat, Oct 22, 2022 at 3:26 PM Joseph Clark via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hi NCL users, >> >> I am using NCL version 6.3.0. I have a line like, >> >> *variable = ncfile[:]->varname* >> >> I get the following error, >> >> >> >> *warning:error attempting to fix non-monotonic aggregation variable* >> I understand exactly what the error is saying, but I do not want the >> concatenation to change the ordering of the leftmost dimension. It is the >> correct order. I know I could make a change to the netcdf files to have a >> time array and time unit that NCL understands is proper order. >> >> * However, it would be simplest if NCL did not "attempt to fix >> non-monotonic aggregation variable" opting instead to ignore what the order >> of the time array is. Is there a way to tell NCL to ignore the >> non-monotonicity? * >> Thanks! >> >> Joe >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From setareh.rahimi at gmail.com Mon Oct 24 06:56:11 2022 From: setareh.rahimi at gmail.com (Setareh Rahimi) Date: Mon, 24 Oct 2022 16:26:11 +0330 Subject: [ncl-talk] Plot near surface wind over dust concenration Message-ID: Dear all NCL users, I tried to plot near-surface wind over dust concentration (from RegCM model) but received errors from NCL. May I ask you to kindly advise me on how to remove those errors? The model outputs, script, and a screenshot of the error messages have been attached. Many thanks in advance, Best wishes, regcm.zip -- S.Rahimi -------------- next part -------------- An HTML attachment was scrubbed... URL: From g.graffino at tim.it Mon Oct 24 13:35:15 2022 From: g.graffino at tim.it (Giorgio Graffino) Date: Mon, 24 Oct 2022 21:35:15 +0200 (CEST) Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: <3451bddb.6b911.183f618eed1.Webtop.50@tim.it> References: <3451bddb.6b911.183f618eed1.Webtop.50@tim.it> Message-ID: <66a953f5.6c62d.1840b7df689.Webtop.68@tim.it> Hello, I'm doing some modifications to the regcoef_dp.f file to consider a zero y-intercept, but now I don't know how to try it in a script. The number of arguments in the fortran subroutine is different than in regCoef_n, so the subroutine is probably going through some more steps, possibly involving this script (https://github.com/NCAR/ncl/blob/develop/ni/src/lib/nfp/regcoefW.c). Am I right? How can I incorporate both fortran and C scripts in my NCL script? I know I can use WRAPIT to read external fortran code, but what about C code? I need help please. Giorgio ------ Messaggio Originale ------ Da: ncl-talk at mailman.ucar.edu A: shea at ucar.edu Cc: ncl-talk at ucar.edu Inviato: venerd? 21 ottobre 2022 13:14 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept Hi Dennis, Dave Thanks for sending the relevant function and for explaining how to access the source code. Now I'm thinking how to make the function to force the regression to pass from origin. Any idea on how to do that? Cheers, Giorgio ------ Messaggio Originale ------ Da: shea at ucar.edu A: g.graffino at tim.it Cc: dave.allured at noaa.gov; ncl-talk at ucar.edu Inviato: gioved? 20 ottobre 2022 19:17 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept The f77 code is attached. On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino via ncl-talk > wrote: Hi Dave, Thanks for the advice. I looked at the examples in https://www.ncl.ucar.edu/Applications/regress.shtml , especially examples 2 and 4, but I couldn't find any supplementary information about regCoef. I also can't find anything under $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please point me where it is? Cheers, Giorgio ------ Messaggio Originale ------ Da: dave.allured at noaa.gov A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: gioved? 13 ottobre 2022 18:47 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept Giorgio, for your second question, please see this very brief description that I recently wrote, for how to search for functions in the NCL source code. https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk > wrote: Hi NCL community, I want regCoef_n to find the regression coefficient between two arrays without y-axis intercept. Do you know how I can change the function to do that? Can you also please tell me where I can find the function? I did a grep recursive search in my $NCARG_ROOT directory but I couldn't find it. Cheers, Giorgio _______________________________________________ ncl-talk mailing list ncl-talk at mailman.ucar.edu List instructions, subscriber options, unsubscribe: https://mailman.ucar.edu/mailman/listinfo/ncl-talk _______________________________________________ ncl-talk mailing list ncl-talk at mailman.ucar.edu List instructions, subscriber options, unsubscribe: https://mailman.ucar.edu/mailman/listinfo/ncl-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.allured at noaa.gov Mon Oct 24 14:10:42 2022 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Mon, 24 Oct 2022 14:10:42 -0600 Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: <66a953f5.6c62d.1840b7df689.Webtop.68@tim.it> References: <3451bddb.6b911.183f618eed1.Webtop.50@tim.it> <66a953f5.6c62d.1840b7df689.Webtop.68@tim.it> Message-ID: Giorgio, you are right, regcoefW.c is an NCL internal interface routine for regCoef_n. But it uses a different protocol than a WRAPIT interfaced function. Just ignore regcoefW.c, and follow the WRAPIT fortran instructions carefully, for your new function. Change the function name, and do not attempt to replace the built-in regCoef_n function. You can change the arguments as you like, but follow the documented WRAPIT rules. There are two different methods for calling external C functions: fortran wrapper, and shared object. Please study the WRAPIT documentation carefully. On Mon, Oct 24, 2022 at 1:35 PM Giorgio Graffino via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hello, > > I'm doing some modifications to the regcoef_dp.f file to consider a zero > y-intercept, but now I don't know how to try it in a script. The number of > arguments in the fortran subroutine is different than in regCoef_n, so > the subroutine is probably going through some more steps, possibly > involving this script ( > https://github.com/NCAR/ncl/blob/develop/ni/src/lib/nfp/regcoefW.c). Am I > right? > > How can I incorporate both fortran and C scripts in my NCL script? I know > I can use WRAPIT to read external fortran code, but what about C code? > > I need help please. > > Giorgio > > > ------ Messaggio Originale ------ > Da: ncl-talk at mailman.ucar.edu > A: shea at ucar.edu > Cc: ncl-talk at ucar.edu > Inviato: venerd? 21 ottobre 2022 13:14 > Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept > > Hi Dennis, Dave > > Thanks for sending the relevant function and for explaining how to access > the source code. Now I'm thinking how to make the function to force the > regression to pass from origin. Any idea on how to do that? > > Cheers, > > Giorgio > > > ------ Messaggio Originale ------ > Da: shea at ucar.edu > A: g.graffino at tim.it > Cc: dave.allured at noaa.gov; ncl-talk at ucar.edu > Inviato: gioved? 20 ottobre 2022 19:17 > Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept > > The f77 code is attached. > > > On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hi Dave, >> >> Thanks for the advice. I looked at the examples in >> https://www.ncl.ucar.edu/Applications/regress.shtml, especially examples >> 2 and 4, but I couldn't find any supplementary information about regCoef. I >> also can't find anything under >> $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and >> $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. >> >> Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please >> point me where it is? >> >> Cheers, >> >> Giorgio >> >> >> ------ Messaggio Originale ------ >> Da: dave.allured at noaa.gov >> A: g.graffino at tim.it >> Cc: ncl-talk at ucar.edu >> Inviato: gioved? 13 ottobre 2022 18:47 >> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >> >> Giorgio, for your second question, please see this very brief description >> that I recently wrote, for how to search for functions in the NCL source >> code. >> https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html >> >> >> On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk < >> ncl-talk at mailman.ucar.edu> wrote: >> >>> Hi NCL community, >>> >>> I want regCoef_n to find the regression coefficient between two arrays >>> without y-axis intercept. Do you know how I can change the function to do >>> that? >>> >>> Can you also please tell me where I can find the function? I did a grep >>> recursive search in my $NCARG_ROOT directory but I couldn't find it. >>> >>> Cheers, >>> >>> Giorgio >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Tue Oct 25 16:17:00 2022 From: shea at ucar.edu (Dennis Shea) Date: Tue, 25 Oct 2022 16:17:00 -0600 Subject: [ncl-talk] Plot near surface wind over dust concenration In-Reply-To: References: Message-ID: ---------------------- I'm not sure why you got: "Warning: Data either does not contain valid latitude coordinate array or doesn't contain one at all." -------------------- For assorted reasons, I do not have NCL on my MAC. Also, I don't have the shape file you are using. Hence, I can not test your code. ======= a wild guess ... any variable to be plotted [zy4] assign lat2d/lon2d to that variable zy4 at lat2d = xlat zy4 at lon2d = xlon delete res at sfXArray = xlon ; equivalently x at lon2d = xlon res at sfYArray = xlat ; equivalently x at lat2d = xlat On Mon, Oct 24, 2022 at 6:56 AM Setareh Rahimi via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Dear all NCL users, > I tried to plot near-surface wind over dust concentration (from RegCM > model) but received errors from NCL. May I ask you to kindly advise me on > how to remove those errors? The model outputs, script, and a screenshot of > the error messages have been attached. > Many thanks in advance, > Best wishes, > regcm.zip > > > > -- > S.Rahimi > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g.graffino at tim.it Wed Oct 26 03:09:17 2022 From: g.graffino at tim.it (Giorgio Graffino) Date: Wed, 26 Oct 2022 11:09:17 +0200 (CEST) Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: <66a953f5.6c62d.1840b7df689.Webtop.68@tim.it> References: <66a953f5.6c62d.1840b7df689.Webtop.68@tim.it> Message-ID: <5f453324.79d79.184138d96f5.Webtop.49@tim.it> Hi Dave, Thanks for confirming that. I'm changing the fortran subroutine Dennis sent last week into a function, but it keeps giving me an error wherever I try to use arrays as arguments. It only works when X and Y are scalar numbers. I really don't understand how a linear regression fit can be found with scalar numbers as arguments. I'm looking at the C interface to see how to subroutine is called, but there are too many things happening in regcoefW.c and it's difficult to understand the workflow. Can anyone please help me understand how to make the fortran subroutine work for 1d and 2d arrays? Cheers, Giorgio ------ Messaggio Originale ------ Da: dave.allured at noaa.gov A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: luned? 24 ottobre 2022 22:10 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept Giorgio, you are right, regcoefW.c is an NCL internal interface routine for regCoef_n. But it uses a different protocol than a WRAPIT interfaced function. Just ignore regcoefW.c, and follow the WRAPIT fortran instructions carefully, for your new function. Change the function name, and do not attempt to replace the built-in regCoef_n function. You can change the arguments as you like, but follow the documented WRAPIT rules. There are two different methods for calling external C functions: fortran wrapper, and shared object. Please study the WRAPIT documentation carefully. On Mon, Oct 24, 2022 at 1:35 PM Giorgio Graffino via ncl-talk > wrote: Hello, I'm doing some modifications to the regcoef_dp.f file to consider a zero y-intercept, but now I don't know how to try it in a script. The number of arguments in the fortran subroutine is different than in regCoef_n, so the subroutine is probably going through some more steps, possibly involving this script (https://github.com/NCAR/ncl/blob/develop/ni/src/lib/nfp/regcoefW.c ). Am I right? How can I incorporate both fortran and C scripts in my NCL script? I know I can use WRAPIT to read external fortran code, but what about C code? I need help please. Giorgio ------ Messaggio Originale ------ Da: ncl-talk at mailman.ucar.edu A: shea at ucar.edu Cc: ncl-talk at ucar.edu Inviato: venerd? 21 ottobre 2022 13:14 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept Hi Dennis, Dave Thanks for sending the relevant function and for explaining how to access the source code. Now I'm thinking how to make the function to force the regression to pass from origin. Any idea on how to do that? Cheers, Giorgio ------ Messaggio Originale ------ Da: shea at ucar.edu A: g.graffino at tim.it Cc: dave.allured at noaa.gov ; ncl-talk at ucar.edu Inviato: gioved? 20 ottobre 2022 19:17 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept The f77 code is attached. On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino via ncl-talk > wrote: Hi Dave, Thanks for the advice. I looked at the examples in https://www.ncl.ucar.edu/Applications/regress.shtml , especially examples 2 and 4, but I couldn't find any supplementary information about regCoef. I also can't find anything under $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please point me where it is? Cheers, Giorgio ------ Messaggio Originale ------ Da: dave.allured at noaa.gov A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: gioved? 13 ottobre 2022 18:47 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept Giorgio, for your second question, please see this very brief description that I recently wrote, for how to search for functions in the NCL source code. https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk > wrote: Hi NCL community, I want regCoef_n to find the regression coefficient between two arrays without y-axis intercept. Do you know how I can change the function to do that? Can you also please tell me where I can find the function? I did a grep recursive search in my $NCARG_ROOT directory but I couldn't find it. Cheers, Giorgio -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.allured at noaa.gov Wed Oct 26 09:10:40 2022 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Wed, 26 Oct 2022 09:10:40 -0600 Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: <5f453324.79d79.184138d96f5.Webtop.49@tim.it> References: <66a953f5.6c62d.1840b7df689.Webtop.68@tim.it> <5f453324.79d79.184138d96f5.Webtop.49@tim.it> Message-ID: Giorgio, WRAPIT is capable of handling arrays correctly. I suggest you try some of the working fortran examples in the WRAPIT documentation, so that you can get familiar with WRAPIT and array arguments. Then, get the *original* regcoef_dp.f working with WRAPIT and arrays, but change the function name to prevent conflict. It might be helpful to write external standalone fortran main programs that call the fortran routines you are testing, to ensure those routines are working independently from NCL. Only after that, try interfacing your modified routine with WRAPIT. Please completely avoid regcoefW.c. It is full of internal protocol that is not related to WRAPIT and will continue to confuse you. I do not have time to analyze or debug your code and procedures. If needed, perhaps someone else is available. On Wed, Oct 26, 2022 at 3:09 AM Giorgio Graffino wrote: > Hi Dave, > > Thanks for confirming that. I'm changing the fortran subroutine Dennis > sent last week into a function, but it keeps giving me an error wherever I > try to use arrays as arguments. It only works when X and Y are scalar > numbers. I really don't understand how a linear regression fit can be found > with scalar numbers as arguments. I'm looking at the C interface to see how > to subroutine is called, but there are too many things happening in > regcoefW.c and it's difficult to understand the workflow. Can anyone please > help me understand how to make the fortran subroutine work for 1d and 2d > arrays? > > Cheers, > > Giorgio > > > ------ Messaggio Originale ------ > Da: dave.allured at noaa.gov > A: g.graffino at tim.it > Cc: ncl-talk at ucar.edu > Inviato: luned? 24 ottobre 2022 22:10 > Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept > > Giorgio, you are right, regcoefW.c is an NCL internal interface routine > for regCoef_n. But it uses a different protocol than a WRAPIT interfaced > function. Just ignore regcoefW.c, and follow the WRAPIT fortran > instructions carefully, for your new function. Change the function name, > and do not attempt to replace the built-in regCoef_n function. You can > change the arguments as you like, but follow the documented WRAPIT rules. > > There are two different methods for calling external C functions: fortran > wrapper, and shared object. Please study the WRAPIT documentation carefully. > > > On Mon, Oct 24, 2022 at 1:35 PM Giorgio Graffino via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hello, >> >> I'm doing some modifications to the regcoef_dp.f file to consider a zero >> y-intercept, but now I don't know how to try it in a script. The number of >> arguments in the fortran subroutine is different than in regCoef_n, so >> the subroutine is probably going through some more steps, possibly >> involving this script ( >> https://github.com/NCAR/ncl/blob/develop/ni/src/lib/nfp/regcoefW.c). Am >> I right? >> >> How can I incorporate both fortran and C scripts in my NCL script? I know >> I can use WRAPIT to read external fortran code, but what about C code? >> >> I need help please. >> >> Giorgio >> >> >> ------ Messaggio Originale ------ >> Da: ncl-talk at mailman.ucar.edu >> A: shea at ucar.edu >> Cc: ncl-talk at ucar.edu >> Inviato: venerd? 21 ottobre 2022 13:14 >> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >> >> Hi Dennis, Dave >> >> Thanks for sending the relevant function and for explaining how to access >> the source code. Now I'm thinking how to make the function to force the >> regression to pass from origin. Any idea on how to do that? >> >> Cheers, >> >> Giorgio >> >> >> ------ Messaggio Originale ------ >> Da: shea at ucar.edu >> A: g.graffino at tim.it >> Cc: dave.allured at noaa.gov; ncl-talk at ucar.edu >> Inviato: gioved? 20 ottobre 2022 19:17 >> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >> >> The f77 code is attached. >> >> >> On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino via ncl-talk < >> ncl-talk at mailman.ucar.edu> wrote: >> >>> Hi Dave, >>> >>> Thanks for the advice. I looked at the examples in >>> https://www.ncl.ucar.edu/Applications/regress.shtml, especially >>> examples 2 and 4, but I couldn't find any supplementary information about >>> regCoef. I also can't find anything under >>> $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and >>> $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. >>> >>> Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please >>> point me where it is? >>> >>> Cheers, >>> >>> Giorgio >>> >>> >>> ------ Messaggio Originale ------ >>> Da: dave.allured at noaa.gov >>> A: g.graffino at tim.it >>> Cc: ncl-talk at ucar.edu >>> Inviato: gioved? 13 ottobre 2022 18:47 >>> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >>> >>> Giorgio, for your second question, please see this very brief >>> description that I recently wrote, for how to search for functions in the >>> NCL source code. >>> https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html >>> >>> >>> On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk < >>> ncl-talk at mailman.ucar.edu> wrote: >>> >>>> Hi NCL community, >>>> >>>> I want regCoef_n to find the regression coefficient between two arrays >>>> without y-axis intercept. Do you know how I can change the function to do >>>> that? >>>> >>>> Can you also please tell me where I can find the function? I did a grep >>>> recursive search in my $NCARG_ROOT directory but I couldn't find it. >>>> >>>> Cheers, >>>> >>>> Giorgio >>>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Thu Oct 27 11:09:37 2022 From: shea at ucar.edu (Dennis Shea) Date: Thu, 27 Oct 2022 11:09:37 -0600 Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: References: <66a953f5.6c62d.1840b7df689.Webtop.68@tim.it> <5f453324.79d79.184138d96f5.Webtop.49@tim.it> Message-ID: This thread is a bit hard to follow for me. [1] re: "Now I'm thinking how to make the function to force the regression to pass from origin. Any idea on how to do that?" I do not know how to accommodate the additional constraint of making the regression line'go through the origin. Likely, googling something like "regression line through the origin" will yield some information. [2] Make sure your modified fortran subroutine works. Initially, code and test this only for one-dimension. We can do multiple dimensions later. EG with the 'gfortran' compiler. I took NCL's underlying fortran subroutine. I changed the source name to RCGRAF/rcgraf to avoid any possible naming conflicts. I wrote a simple fortran driver. Any fortran compiler will work %> gfortran tst_regcoef.f regcoef_graffino.f <=== compile fortran codes %> ./a.out <=== execute the compiled codes rcoef= 0.974561453 tval = 38.7428589 yint = 15.3522949 [3] Now, modify the "regcoef_graffino.f " to create a regression line where there is no y-intercept [4] Repeat step [2] with your modified code. [5] Create a .so file via %> WRAPIT regcoef_graffino.f will create regcoef_graffino.so [6] Create a simple 1D test of invoking the .so file and print results [7] At this point, we can make a 2nd subroutine that invokes the .so file multiple times. If The (hidden) C interface to the f77 subroutine just loops over the appropriate dimensions and returns the various results. --- If you have 1D arrays [ X[N], Y[N] ] On Wed, Oct 26, 2022 at 9:10 AM Dave Allured - NOAA Affiliate via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Giorgio, WRAPIT is capable of handling arrays correctly. I suggest you > try some of the working fortran examples in the WRAPIT documentation, so > that you can get familiar with WRAPIT and array arguments. Then, get the > *original* regcoef_dp.f working with WRAPIT and arrays, but change the > function name to prevent conflict. It might be helpful to write external > standalone fortran main programs that call the fortran routines you are > testing, to ensure those routines are working independently from NCL. > > Only after that, try interfacing your modified routine with WRAPIT. > Please completely avoid regcoefW.c. It is full of internal protocol that > is not related to WRAPIT and will continue to confuse you. > > I do not have time to analyze or debug your code and procedures. If > needed, perhaps someone else is available. > > > On Wed, Oct 26, 2022 at 3:09 AM Giorgio Graffino > wrote: > >> Hi Dave, >> >> Thanks for confirming that. I'm changing the fortran subroutine Dennis >> sent last week into a function, but it keeps giving me an error wherever I >> try to use arrays as arguments. It only works when X and Y are scalar >> numbers. I really don't understand how a linear regression fit can be found >> with scalar numbers as arguments. I'm looking at the C interface to see how >> to subroutine is called, but there are too many things happening in >> regcoefW.c and it's difficult to understand the workflow. Can anyone please >> help me understand how to make the fortran subroutine work for 1d and 2d >> arrays? >> >> Cheers, >> >> Giorgio >> >> >> ------ Messaggio Originale ------ >> Da: dave.allured at noaa.gov >> A: g.graffino at tim.it >> Cc: ncl-talk at ucar.edu >> Inviato: luned? 24 ottobre 2022 22:10 >> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >> >> Giorgio, you are right, regcoefW.c is an NCL internal interface routine >> for regCoef_n. But it uses a different protocol than a WRAPIT interfaced >> function. Just ignore regcoefW.c, and follow the WRAPIT fortran >> instructions carefully, for your new function. Change the function name, >> and do not attempt to replace the built-in regCoef_n function. You can >> change the arguments as you like, but follow the documented WRAPIT rules. >> >> There are two different methods for calling external C functions: fortran >> wrapper, and shared object. Please study the WRAPIT documentation carefully. >> >> >> On Mon, Oct 24, 2022 at 1:35 PM Giorgio Graffino via ncl-talk < >> ncl-talk at mailman.ucar.edu> wrote: >> >>> Hello, >>> >>> I'm doing some modifications to the regcoef_dp.f file to consider a >>> zero y-intercept, but now I don't know how to try it in a script. The >>> number of arguments in the fortran subroutine is different than in >>> regCoef_n, so the subroutine is probably going through some more steps, >>> possibly involving this script ( >>> https://github.com/NCAR/ncl/blob/develop/ni/src/lib/nfp/regcoefW.c). Am >>> I right? >>> >>> How can I incorporate both fortran and C scripts in my NCL script? I >>> know I can use WRAPIT to read external fortran code, but what about C code? >>> >>> I need help please. >>> >>> Giorgio >>> >>> >>> ------ Messaggio Originale ------ >>> Da: ncl-talk at mailman.ucar.edu >>> A: shea at ucar.edu >>> Cc: ncl-talk at ucar.edu >>> Inviato: venerd? 21 ottobre 2022 13:14 >>> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >>> >>> Hi Dennis, Dave >>> >>> Thanks for sending the relevant function and for explaining how to >>> access the source code. Now I'm thinking how to make the function to force >>> the regression to pass from origin. Any idea on how to do that? >>> >>> Cheers, >>> >>> Giorgio >>> >>> >>> ------ Messaggio Originale ------ >>> Da: shea at ucar.edu >>> A: g.graffino at tim.it >>> Cc: dave.allured at noaa.gov; ncl-talk at ucar.edu >>> Inviato: gioved? 20 ottobre 2022 19:17 >>> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >>> >>> The f77 code is attached. >>> >>> >>> On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino via ncl-talk < >>> ncl-talk at mailman.ucar.edu> wrote: >>> >>>> Hi Dave, >>>> >>>> Thanks for the advice. I looked at the examples in >>>> https://www.ncl.ucar.edu/Applications/regress.shtml, especially >>>> examples 2 and 4, but I couldn't find any supplementary information about >>>> regCoef. I also can't find anything under >>>> $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and >>>> $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. >>>> >>>> Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please >>>> point me where it is? >>>> >>>> Cheers, >>>> >>>> Giorgio >>>> >>>> >>>> ------ Messaggio Originale ------ >>>> Da: dave.allured at noaa.gov >>>> A: g.graffino at tim.it >>>> Cc: ncl-talk at ucar.edu >>>> Inviato: gioved? 13 ottobre 2022 18:47 >>>> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >>>> >>>> Giorgio, for your second question, please see this very brief >>>> description that I recently wrote, for how to search for functions in the >>>> NCL source code. >>>> https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html >>>> >>>> >>>> On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk < >>>> ncl-talk at mailman.ucar.edu> wrote: >>>> >>>>> Hi NCL community, >>>>> >>>>> I want regCoef_n to find the regression coefficient between two arrays >>>>> without y-axis intercept. Do you know how I can change the function to do >>>>> that? >>>>> >>>>> Can you also please tell me where I can find the function? I did a >>>>> grep recursive search in my $NCARG_ROOT directory but I couldn't find >>>>> it. >>>>> >>>>> Cheers, >>>>> >>>>> Giorgio >>>>> >>>> _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Thu Oct 27 11:30:57 2022 From: shea at ucar.edu (Dennis Shea) Date: Thu, 27 Oct 2022 11:30:57 -0600 Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: References: <66a953f5.6c62d.1840b7df689.Webtop.68@tim.it> <5f453324.79d79.184138d96f5.Webtop.49@tim.it> Message-ID: Oops. I inadvertently did not attach the fortran codes. On Thu, Oct 27, 2022 at 11:09 AM Dennis Shea wrote: > This thread is a bit hard to follow for me. > > [1] re: "Now I'm thinking how to make the function to force the regression > to pass from origin. Any idea on how to do that?" > I do not know how to accommodate the additional constraint of making > the regression line'go through the origin. > Likely, googling something like "regression line through the origin" > will yield some information. > > [2] Make sure your modified fortran subroutine works. Initially, code and > test this only for one-dimension. We can do multiple dimensions later. > EG with the 'gfortran' compiler. > I took NCL's underlying fortran subroutine. I changed the source name > to RCGRAF/rcgraf to avoid any possible naming conflicts. I wrote a simple > fortran driver. Any fortran compiler will work > > %> gfortran tst_regcoef.f regcoef_graffino.f <=== compile > fortran codes > %> ./a.out > <=== execute the compiled codes > > rcoef= 0.974561453 > tval = 38.7428589 > yint = 15.3522949 > > [3] Now, modify the "regcoef_graffino.f " to create a regression line > where there is no y-intercept > > [4] Repeat step [2] with your modified code. > > [5] Create a .so file via > > %> WRAPIT regcoef_graffino.f > > will create regcoef_graffino.so > > [6] Create a simple 1D test of invoking the .so file and print results > > [7] At this point, we can make a 2nd subroutine that invokes the .so file > multiple times. > > > > > > > > > > > > If The (hidden) C interface to the f77 subroutine just loops over the > appropriate dimensions and returns the various results. > > --- > If you have 1D arrays [ X[N], Y[N] ] > > > On Wed, Oct 26, 2022 at 9:10 AM Dave Allured - NOAA Affiliate via ncl-talk > wrote: > >> Giorgio, WRAPIT is capable of handling arrays correctly. I suggest you >> try some of the working fortran examples in the WRAPIT documentation, so >> that you can get familiar with WRAPIT and array arguments. Then, get the >> *original* regcoef_dp.f working with WRAPIT and arrays, but change the >> function name to prevent conflict. It might be helpful to write external >> standalone fortran main programs that call the fortran routines you are >> testing, to ensure those routines are working independently from NCL. >> >> Only after that, try interfacing your modified routine with WRAPIT. >> Please completely avoid regcoefW.c. It is full of internal protocol that >> is not related to WRAPIT and will continue to confuse you. >> >> I do not have time to analyze or debug your code and procedures. If >> needed, perhaps someone else is available. >> >> >> On Wed, Oct 26, 2022 at 3:09 AM Giorgio Graffino >> wrote: >> >>> Hi Dave, >>> >>> Thanks for confirming that. I'm changing the fortran subroutine Dennis >>> sent last week into a function, but it keeps giving me an error wherever I >>> try to use arrays as arguments. It only works when X and Y are scalar >>> numbers. I really don't understand how a linear regression fit can be found >>> with scalar numbers as arguments. I'm looking at the C interface to see how >>> to subroutine is called, but there are too many things happening in >>> regcoefW.c and it's difficult to understand the workflow. Can anyone please >>> help me understand how to make the fortran subroutine work for 1d and 2d >>> arrays? >>> >>> Cheers, >>> >>> Giorgio >>> >>> >>> ------ Messaggio Originale ------ >>> Da: dave.allured at noaa.gov >>> A: g.graffino at tim.it >>> Cc: ncl-talk at ucar.edu >>> Inviato: luned? 24 ottobre 2022 22:10 >>> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >>> >>> Giorgio, you are right, regcoefW.c is an NCL internal interface routine >>> for regCoef_n. But it uses a different protocol than a WRAPIT interfaced >>> function. Just ignore regcoefW.c, and follow the WRAPIT fortran >>> instructions carefully, for your new function. Change the function name, >>> and do not attempt to replace the built-in regCoef_n function. You can >>> change the arguments as you like, but follow the documented WRAPIT rules. >>> >>> There are two different methods for calling external C functions: >>> fortran wrapper, and shared object. Please study the WRAPIT documentation >>> carefully. >>> >>> >>> On Mon, Oct 24, 2022 at 1:35 PM Giorgio Graffino via ncl-talk < >>> ncl-talk at mailman.ucar.edu> wrote: >>> >>>> Hello, >>>> >>>> I'm doing some modifications to the regcoef_dp.f file to consider a >>>> zero y-intercept, but now I don't know how to try it in a script. The >>>> number of arguments in the fortran subroutine is different than in >>>> regCoef_n, so the subroutine is probably going through some more steps, >>>> possibly involving this script ( >>>> https://github.com/NCAR/ncl/blob/develop/ni/src/lib/nfp/regcoefW.c). >>>> Am I right? >>>> >>>> How can I incorporate both fortran and C scripts in my NCL script? I >>>> know I can use WRAPIT to read external fortran code, but what about C code? >>>> >>>> I need help please. >>>> >>>> Giorgio >>>> >>>> >>>> ------ Messaggio Originale ------ >>>> Da: ncl-talk at mailman.ucar.edu >>>> A: shea at ucar.edu >>>> Cc: ncl-talk at ucar.edu >>>> Inviato: venerd? 21 ottobre 2022 13:14 >>>> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >>>> >>>> Hi Dennis, Dave >>>> >>>> Thanks for sending the relevant function and for explaining how to >>>> access the source code. Now I'm thinking how to make the function to force >>>> the regression to pass from origin. Any idea on how to do that? >>>> >>>> Cheers, >>>> >>>> Giorgio >>>> >>>> >>>> ------ Messaggio Originale ------ >>>> Da: shea at ucar.edu >>>> A: g.graffino at tim.it >>>> Cc: dave.allured at noaa.gov; ncl-talk at ucar.edu >>>> Inviato: gioved? 20 ottobre 2022 19:17 >>>> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >>>> >>>> The f77 code is attached. >>>> >>>> >>>> On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino via ncl-talk < >>>> ncl-talk at mailman.ucar.edu> wrote: >>>> >>>>> Hi Dave, >>>>> >>>>> Thanks for the advice. I looked at the examples in >>>>> https://www.ncl.ucar.edu/Applications/regress.shtml, especially >>>>> examples 2 and 4, but I couldn't find any supplementary information about >>>>> regCoef. I also can't find anything under >>>>> $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and >>>>> $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. >>>>> >>>>> Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please >>>>> point me where it is? >>>>> >>>>> Cheers, >>>>> >>>>> Giorgio >>>>> >>>>> >>>>> ------ Messaggio Originale ------ >>>>> Da: dave.allured at noaa.gov >>>>> A: g.graffino at tim.it >>>>> Cc: ncl-talk at ucar.edu >>>>> Inviato: gioved? 13 ottobre 2022 18:47 >>>>> Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept >>>>> >>>>> Giorgio, for your second question, please see this very brief >>>>> description that I recently wrote, for how to search for functions in the >>>>> NCL source code. >>>>> https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html >>>>> >>>>> >>>>> On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk < >>>>> ncl-talk at mailman.ucar.edu> wrote: >>>>> >>>>>> Hi NCL community, >>>>>> >>>>>> I want regCoef_n to find the regression coefficient between two >>>>>> arrays without y-axis intercept. Do you know how I can change the function >>>>>> to do that? >>>>>> >>>>>> Can you also please tell me where I can find the function? I did a >>>>>> grep recursive search in my $NCARG_ROOT directory but I couldn't >>>>>> find it. >>>>>> >>>>>> Cheers, >>>>>> >>>>>> Giorgio >>>>>> >>>>> _______________________________________________ >> ncl-talk mailing list >> ncl-talk at mailman.ucar.edu >> List instructions, subscriber options, unsubscribe: >> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: tst_regcoef.f Type: application/octet-stream Size: 877 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: regcoef_graffino.f Type: application/octet-stream Size: 2325 bytes Desc: not available URL: From setareh.rahimi at gmail.com Sun Oct 30 11:31:09 2022 From: setareh.rahimi at gmail.com (Setareh Rahimi) Date: Sun, 30 Oct 2022 21:01:09 +0330 Subject: [ncl-talk] How to convert NCL script to a NetCDF file? Message-ID: Dear all NCL users, Using R software, I want to plot aerosol optical depth (AOD) from the WRF-chem model. Once import the model output in the R, the software can not recognize the lat/lon. So I need to convert my NCL script to a NetCDF file in an easily readable way for the R. How can I convert my NCL script (which includes converted time, lat/lon, and calculate AOD) to a new NetCDF file, please? The script and the model output have been attached. wef_chem.nc.gz -- S.Rahimi -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" ;*************************************************************************************************************************** ;;f = addfile ("wrfout_d01_2011-07-01_00:00:12", "r") f = addfile ("setareh_chem.nc", "r") print(f) ; same as "nmcdump -h" Times = f->Times ; [Time | 41] x [DateStrLen | 19] (character) Time_0 = wrf_times_c( Times, 0 ) ; "hours since" initial time on file (double) ; Time_0 is recognized by cd_calendar Time_3 = wrf_times_c( Times, 3 ) ; yyyymmddhh (type "integer") Time_3 = Time_3/100 ; remove 'ss' part of Time_3 Time_3 at units = "yyyymmdd" print("********************************************************************************************************************") wks = gsn_open_wks("pdf" ,"WRF_aod_Daily-Average") ; ps,pdf,x11,ncgm,eps gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; select color map res = True ; plot mods desired res at cnConstFEnableFill = True res at gsnMaximize = True res at gsnSpreadColors = True res at cnFillOn = True res at cnLinesOn = False res at cnLineLabelsOn = False WRF_map_c(f, res, 0) res at tfDoNDCOverlay = True res at pmTickMarkDisplayMode = "Always" ;*************************************************************************************************************************** ymd = cd_calendar(Time_0, -2) print(ymd) YMD = 20110701 mt = ind(YMD.eq.ymd) ;;print(mt) A2 = f->TAUAER2 ; (Time, south_north, west_east) A2&Time = Time_0 ; associate the 'Time' coordinate with the variable using standard NCL & syntax a2 = A2(mt,:,:,:) ; (Time, south_north, west_east) printVarSummary(a2) ; [Time | 8] x [bottom_top | 35] x [south_north | 199] x [west_east | 199] delete(A2) B3 = f->TAUAER3 ; (Time, south_north, west_east) B3&Time = Time_0 ; associate the 'Time' coordinate with the variable using standard NCL & syntax b3 = B3(mt,:,:,:) ; (Time, south_north, west_east) printVarSummary(b3) ; [Time | 8] x [bottom_top | 35] x [south_north | 199] x [west_east | 199] delete(B3) time_3 = Time_3(mt) ; (Time | 8) print(time_3) print("********************************************************************************************************************") opt_cdv = True ; option for calculate_daily_values (cdv) opt_cdv at nval_crit = 4 ; default is 1 a2Day = calculate_daily_values (a2, "avg", 0, opt_cdv) printVarSummary(a2Day) ; [Time | 1] x [bottom_top | 35] x [south_north | 199] x [west_east | 199] printMinMax (a2Day,1) b3Day = calculate_daily_values (b3, "avg", 0, opt_cdv) printVarSummary(b3Day) ; [Time | 1] x [bottom_top | 35] x [south_north | 199] x [west_east | 199] printMinMax (b3Day,1) print("") print("***********************************************************************************************************") print("") angstrom_exponent = -(log(a2Day)-log(b3Day))/log(400./600.) printVarSummary(angstrom_exponent) ; [1] x [35] x [199] x [199] printMinMax((angstrom_exponent) ; [1] x [35] x [199] x [199] AOD550_3D = a2Day * ((400.0/550.0)^angstrom_exponent) ;AOD550_3D at long_name = "AOD550_3D" AOD550_3D at description = "AOD550_3D" copy_VarCoords(a2Day,AOD550_3D ) printVarSummary(AOD550_3D) ; [Time | 1] x [bottom_top | 35] x [south_north | 199] x [west_east | 199] AOD550_2D = dim_sum_n_Wrap(AOD550_3D,0) ;AOD550_2D at long_name = "AOD550_2D" AOD550_2D at description = "AOD550_2D" printVarSummary(AOD550_2D) ; [bottom_top | 35] x [south_north | 199] x [west_east | 199] if (any(isnan_ieee(AOD550_2D))) then value = 9.96921e+36 replace_ieeenan (AOD550_2D,value,0) AOD550_2D at _FillValue = value end if printVarSummary(AOD550_2D) printMinMax (AOD550_2D,1) print("") print("***********************************************************************************************************") print("") res at tiMainString = "WRF-CHEM (aod_550) " + time_3(0) ;;res at gsnLeftString = a at description ; ????????????????? res at gsnLeftString = AOD550_2D at description print(res) ;;plot = gsn_csm_contour_map(wks,AOD550_2D( ???,:,:),res) ;;;==================================== ;;; Possible changes ;;; ;;; AOD550_2D = dim_sum_n_Wrap(AOD550_3D,1) ; sum all the levels ;;; ;AOD550_2D at long_name = "AOD550_2D" ;;; AOD550_2D at description = "AOD550_2D" ;;; printVarSummary(AOD550_2D) ; [Time | 1] x [south_north | 199] x [west_east | 199] ;;; if (any(isnan_ieee(AOD550_2D))) then ;;; value = 9.96921e+36 ;;; replace_ieeenan (AOD550_2D,value,0) ;;; AOD550_2D at _FillValue = value ;;; end if ;;; printVarSummary(AOD550_2D) ;;; printMinMax (AOD550_2D,1) ;;; print("") ;;; ; ;print("***********************************************************************************************************") ;;; print("") ;;; res at tiMainString = "WRF-CHEM (aod_550) " + time_3(0) ;;res at gsnLeftString = a at description ; ????????????????? ;;; res at gsnLeftString = AOD550_2D at description print(res) ;;plot = gsn_csm_contour_map(wks,AOD550_2D(0,:,:),res) From shea at ucar.edu Sun Oct 30 17:47:03 2022 From: shea at ucar.edu (Dennis Shea) Date: Sun, 30 Oct 2022 17:47:03 -0600 Subject: [ncl-talk] How to convert NCL script to a NetCDF file? In-Reply-To: References: Message-ID: "The [R] software can not recognize the lat/lon. So I need to convert my NCL script to a NetCDF file in an easily readable way for the R." ==== ncl-talk does not have much experience with R. The description "The [R] software can not recognize the lat/lon." Perhaps, the fact the the XLAT and XLONG are three dimensional (Time, south_north, west_east) causes the problem? I do not think ncl-talk is going to learn R's reading of netCDF files. ***That is your responsibility. *** ====================== NOT TESTED ==================== load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" inNC = "wef_chem.nc" ; original file f = addfile(inNC, "r") Times = f->Times ; char Times(Time, DateStrLen) ; ; ; https://www.ncl.ucar.edu/Document/Functions/WRF_contributed/wrf_times_c.shtml ; *time = wrf_times_c*( Times, 3 ) ; yyyymmddhh (integer) time!0 = "time" ; name the dimension time&time = time TAUAER2 = f->TAUAER2 TAUAER2!0 = "time" TAUAER2&time = time TAUAER3 = f->TAUAER3 TAUAER3!0 = "time" TAUAER3&time = time xlat_2d = f->XLAT(0,:,:) ; 3D->2D xlong_2d = f->XLONG(0,:,:) printVarSummaary(time) printVarSummaary(xlat_2d) printVarSummaary(xlong_2d) printVarSummaary(TAUAER2) printVarSummaary(TAUAER3) ;----------------------------- newNC = "setarah.nc" *system* ("/bin/rm -f + newNC) ; remove any pre-existing file ncOUT = *addfile* (newNC ,"c") ; open OUTPUT netCDF file ;=================================================================== ; create global attributes of the file (optional) ;=================================================================== fAtt = True ; assign file attributes fAtt at title = "REWRITE of " + inNC fAtt at source_file = inNC ;;fAtt at Conventions = "None" fAtt at creation_date = *systemfunc* ("date") *fileattdef* ( ncOUT, fAtt ) ; add new attributes ncOUT->time = time ncOUT->XLAT = xlat_2d ncOUT->XLONG = xlong_2d ncOUT->TAUAER2 = TAUAER2 ncOUT->TAUAER3 = TAUAER3 On Sun, Oct 30, 2022 at 11:31 AM Setareh Rahimi via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Dear all NCL users, > Using R software, I want to plot aerosol optical depth (AOD) from the > WRF-chem model. Once import the model output in the R, the software can not > recognize the lat/lon. So I need to convert my NCL script to a NetCDF file > in an easily readable way for the R. How can I convert my NCL script (which > includes converted time, lat/lon, and calculate AOD) to a new NetCDF file, > please? The script and the model output have been attached. > wef_chem.nc.gz > > > -- > S.Rahimi > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From samo.diatta at univ-zig.sn Sun Oct 30 20:11:19 2022 From: samo.diatta at univ-zig.sn (samo diatta) Date: Mon, 31 Oct 2022 03:11:19 +0100 Subject: [ncl-talk] How to convert NCL script to a NetCDF file? In-Reply-To: References: Message-ID: please authorize the download of the file, maybe I can help. S. Le dim. 30 oct. 2022 ? 18:31, Setareh Rahimi via ncl-talk < ncl-talk at mailman.ucar.edu> a ?crit : > Dear all NCL users, > Using R software, I want to plot aerosol optical depth (AOD) from the > WRF-chem model. Once import the model output in the R, the software can not > recognize the lat/lon. So I need to convert my NCL script to a NetCDF file > in an easily readable way for the R. How can I convert my NCL script (which > includes converted time, lat/lon, and calculate AOD) to a new NetCDF file, > please? The script and the model output have been attached. > wef_chem.nc.gz > > > -- > S.Rahimi > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -- *Dr Samo DIATTA* *Chef du d?partement de Physique* *UFR-ST / **UASZ* -------------- next part -------------- An HTML attachment was scrubbed... URL: From S1073755 at pm.univpm.it Mon Oct 31 09:27:04 2022 From: S1073755 at pm.univpm.it (Mauro Morichetti) Date: Mon, 31 Oct 2022 15:27:04 +0000 Subject: [ncl-talk] Incorrect plot Message-ID: Hi all, I have problem to plot the data from the following link: GRISO_Vaia.nc drive.google.com [cid:41965194-48c0-43c3-bbe2-eed7ae5fa323 at eurprd04.prod.outlook.com] I have nominated the variables and added the units to the coordinates, but the plot is not plot correctly, what I am missing? The scripts I used is attached, could you help me please? Thanks Regards Mauro -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: drive_2020q4_32dp.png Type: image/png Size: 831 bytes Desc: drive_2020q4_32dp.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: GRISO_map.ncl Type: application/octet-stream Size: 3221 bytes Desc: GRISO_map.ncl URL: From rashidcomsis at gmail.com Mon Oct 31 12:44:25 2022 From: rashidcomsis at gmail.com (Rashed Mahmood) Date: Mon, 31 Oct 2022 14:44:25 -0400 Subject: [ncl-talk] Incorrect plot In-Reply-To: References: Message-ID: Hi Mauro, I think the data file is poorly formatted. There are several issues with the data, most important ones are: *1) mismatch of dimensions between variable and the coordinates:* Lat/Lon: Dimensions and sizes: [*yc | 912]* x [xc | 444] prec: Dimensions and sizes: [zt | 48] x [yt | 444] x [*xt | 912*] This can be solved by dimension reordering (see in the attached script). *2) The data contains NaNs:* GRISO hourly precip rate (mm/h) : min=-nan max=-nan NCL has a special function to deal with these (see also in the attached script). Also you can use NCL's special attributes lat2d and lon2d for assigning 2d coordinates to the variable (see in attached script). The attached script seems to plot correctly, but make sure that dimension reordering is correct (that is lat and lon are not swapped incorrectly). Cheers, Rashed On Mon, Oct 31, 2022 at 11:27 AM Mauro Morichetti via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi all, > > I have problem to plot the data from the following link: > > > GRISO_Vaia.nc > > drive.google.com > > > > > > > > > I have nominated the variables and added the units to the coordinates, but > the plot is not plot correctly, what I am missing? > > The scripts I used is attached, could you help me please? > > Thanks > > Regards > > Mauro > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: drive_2020q4_32dp.png Type: image/png Size: 831 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: GRISO_map.ncl Type: application/octet-stream Size: 3950 bytes Desc: not available URL: From g.graffino at tim.it Mon Oct 31 13:04:52 2022 From: g.graffino at tim.it (Giorgio Graffino) Date: Mon, 31 Oct 2022 20:04:52 +0100 (CET) Subject: [ncl-talk] regCoef_n without y-axis intercept In-Reply-To: References: Message-ID: <40188def.79149.1842f6ea8b6.Webtop.71@tim.it> Hi Dennis, Thanks a lot for taking the time to write the scripts and the instructions. With your help I managed to make my version of the subroutine work (see attached) in my NCL script. Using the debug printing part, I checked that the subroutine version with the intercept gives the same result of regCoef_n. Now I'm trying to make the subroutine to return all the calculated variables (and most notably the regression coefficient), but I can't. Can I do that from NCL or do I have to write a separate Fortran script? Cheers, Giorgio ------ Messaggio Originale ------ Da: shea at ucar.edu A: dave.allured at noaa.gov Cc: g.graffino at tim.it; ncl-talk at ucar.edu Inviato: gioved? 27 ottobre 2022 19:30 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept Oops. I inadvertently did not attach the fortran codes. On Thu, Oct 27, 2022 at 11:09 AM Dennis Shea > wrote: This thread is a bit hard to follow for me. [1] re: "Now I'm thinking how to make the function to force the regression to pass from origin. Any idea on how to do that?" I do not know how to accommodate the additional constraint of making the regression line'go through the origin. Likely, googling something like "regression line through the origin" will yield some information. [2] Make sure your modified fortran subroutine works. Initially, code and test this only for one-dimension. We can do multiple dimensions later. EG with the 'gfortran' compiler. I took NCL's underlying fortran subroutine. I changed the source name to RCGRAF/rcgraf to avoid any possible naming conflicts. I wrote a simple fortran driver. Any fortran compiler will work %> gfortran tst_regcoef.f regcoef_graffino.f <=== compile fortran codes %> ./a.out <=== execute the compiled codes rcoef= 0.974561453 tval = 38.7428589 yint = 15.3522949 [3] Now, modify the "regcoef_graffino.f " to create a regression line where there is no y-intercept [4] Repeat step [2] with your modified code. [5] Create a .so file via %> WRAPIT regcoef_graffino.f will create regcoef_graffino.so [6] Create a simple 1D test of invoking the .so file and print results [7] At this point, we can make a 2nd subroutine that invokes the .so file multiple times. If The (hidden) C interface to the f77 subroutine just loops over the appropriate dimensions and returns the various results. --- If you have 1D arrays [ X[N], Y[N] ] On Wed, Oct 26, 2022 at 9:10 AM Dave Allured - NOAA Affiliate via ncl-talk > wrote: Giorgio, WRAPIT is capable of handling arrays correctly. I suggest you try some of the working fortran examples in the WRAPIT documentation, so that you can get familiar with WRAPIT and array arguments. Then, get the original regcoef_dp.f working with WRAPIT and arrays, but change the function name to prevent conflict. It might be helpful to write external standalone fortran main programs that call the fortran routines you are testing, to ensure those routines are working independently from NCL. Only after that, try interfacing your modified routine with WRAPIT. Please completely avoid regcoefW.c. It is full of internal protocol that is not related to WRAPIT and will continue to confuse you. I do not have time to analyze or debug your code and procedures. If needed, perhaps someone else is available. On Wed, Oct 26, 2022 at 3:09 AM Giorgio Graffino > wrote: Hi Dave, Thanks for confirming that. I'm changing the fortran subroutine Dennis sent last week into a function, but it keeps giving me an error wherever I try to use arrays as arguments. It only works when X and Y are scalar numbers. I really don't understand how a linear regression fit can be found with scalar numbers as arguments. I'm looking at the C interface to see how to subroutine is called, but there are too many things happening in regcoefW.c and it's difficult to understand the workflow. Can anyone please help me understand how to make the fortran subroutine work for 1d and 2d arrays? Cheers, Giorgio ------ Messaggio Originale ------ Da: dave.allured at noaa.gov A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: luned? 24 ottobre 2022 22:10 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept Giorgio, you are right, regcoefW.c is an NCL internal interface routine for regCoef_n. But it uses a different protocol than a WRAPIT interfaced function. Just ignore regcoefW.c, and follow the WRAPIT fortran instructions carefully, for your new function. Change the function name, and do not attempt to replace the built-in regCoef_n function. You can change the arguments as you like, but follow the documented WRAPIT rules. There are two different methods for calling external C functions: fortran wrapper, and shared object. Please study the WRAPIT documentation carefully. On Mon, Oct 24, 2022 at 1:35 PM Giorgio Graffino via ncl-talk > wrote: Hello, I'm doing some modifications to the regcoef_dp.f file to consider a zero y-intercept, but now I don't know how to try it in a script. The number of arguments in the fortran subroutine is different than in regCoef_n, so the subroutine is probably going through some more steps, possibly involving this script (https://github.com/NCAR/ncl/blob/develop/ni/src/lib/nfp/regcoefW.c ). Am I right? How can I incorporate both fortran and C scripts in my NCL script? I know I can use WRAPIT to read external fortran code, but what about C code? I need help please. Giorgio ------ Messaggio Originale ------ Da: ncl-talk at mailman.ucar.edu A: shea at ucar.edu Cc: ncl-talk at ucar.edu Inviato: venerd? 21 ottobre 2022 13:14 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept Hi Dennis, Dave Thanks for sending the relevant function and for explaining how to access the source code. Now I'm thinking how to make the function to force the regression to pass from origin. Any idea on how to do that? Cheers, Giorgio ------ Messaggio Originale ------ Da: shea at ucar.edu A: g.graffino at tim.it Cc: dave.allured at noaa.gov ; ncl-talk at ucar.edu Inviato: gioved? 20 ottobre 2022 19:17 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept The f77 code is attached. On Thu, Oct 20, 2022 at 9:53 AM Giorgio Graffino via ncl-talk > wrote: Hi Dave, Thanks for the advice. I looked at the examples in https://www.ncl.ucar.edu/Applications/regress.shtml , especially examples 2 and 4, but I couldn't find any supplementary information about regCoef. I also can't find anything under $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl and $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl. Is NCL source code located anywhere in $NCARG_ROOT? Can anyone please point me where it is? Cheers, Giorgio ------ Messaggio Originale ------ Da: dave.allured at noaa.gov A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: gioved? 13 ottobre 2022 18:47 Oggetto: Re: [ncl-talk] regCoef_n without y-axis intercept Giorgio, for your second question, please see this very brief description that I recently wrote, for how to search for functions in the NCL source code. https://mailman.ucar.edu/pipermail/ncl-talk/2022-August/018954.html On Thu, Oct 13, 2022 at 10:38 AM Giorgio Graffino via ncl-talk > wrote: Hi NCL community, I want regCoef_n to find the regression coefficient between two arrays without y-axis intercept. Do you know how I can change the function to do that? Can you also please tell me where I can find the function? I did a grep recursive search in my $NCARG_ROOT directory but I couldn't find it. Cheers, Giorgio _______________________________________________ ncl-talk mailing list ncl-talk at mailman.ucar.edu List instructions, subscriber options, unsubscribe: https://mailman.ucar.edu/mailman/listinfo/ncl-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: regcoef_dp_zerointercept.f Type: text/x-fortran Size: 4891 bytes Desc: not available URL: