[ncl-talk] Daily averaged ozone concentration
Bucaram Carbo, Carlos
carlos.bucaramcarbo at und.edu
Sun Aug 13 18:54:08 MDT 2017
Hi,
We incorporated the recommendations into the plots, as they could be seen on the attached ones, and will certainly help in the course of this research effort. Also as recommended we used the White to Red palette (res at cnFillPalette = "WhiteBlueGreenYellowRed"), and it did help to better identify the regions of the domain with high o3 incidence.
Thanks for your help,
Carlos
________________________________
From: Dennis Shea <shea at ucar.edu>
Sent: Saturday, August 12, 2017 3:08:00 PM
To: Bucaram Carbo, Carlos
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] Daily averaged ozone concentration
Hello Carlos
Please post all questions to ncl-talk. That is important. This response includes ncl-talk.
I asked you to look at the tutorial. It contains a lot of useful material.
[1]
As noted in many graphic examples and the tutorial, you can set the min/max/interval. For example:
res at cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
res at cnMinLevelValF = 0. ; set min contour level
res at cnMaxLevelValF = 90. ; set max contour level
res at cnLevelSpacingF = 5. ; set contour spacing
Actually, since the O3 are never below zero. Maybe
res at cnMinLevelValF = 5. ; set min contour level
res at cnMaxLevelValF = 90. ; set max contour level
res at cnLevelSpacingF = 5. ; set contour spacing
[2]
You can easily change the units yourself. This is very basic.
diri = "./"
fili = "o3.day.nc<http://o3.day.nc>"
pthi = diri+fili
f = addfile(pthi, "r")
x = f->o3DayAvg
x = x*1000 ; change units
x at units = "ppbv" ; update units metadata
[3]
Comment: Usually a 'white-in-the-middle' colormap
is used for anomalies (eg: -50 to +50) where near-zero
values are not so important.
Assuming that low O3 values are not so important, I suggest
a colormap that starts with white or some 'light' color
http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml
res at cnFillPalette = "WhiteBlueGreenYellowRed"
Use color emphasize important features.
[4] animation: Please read and experiment
https://www.ncl.ucar.edu/Applications/animate.shtml
See Examples 2 & 4
Again, please respond to ncl-talk only. Further, it is best to not
include any salutation (Hi/Dear/... Dennis). Once you do that
'your problem is now my problem'
I am not a animation expert.
On Fri, Aug 11, 2017 at 7:30 PM, Bucaram Carbo, Carlos <carlos.bucaramcarbo at und.edu<mailto:carlos.bucaramcarbo at und.edu>> wrote:
Hi Dennis,
Thank you for your comments and observations. They have all been very helpful. As you might see on the attached wrf_hrly_to_daily.out file the wrf_hrly_to_daily.ncl script worked very well, as well as the new plot_o3.ncl script for visualization. We renamed the plot_o3.ncl script plot_max_o3.ncl, since we switched from average values to maximum values on the wrf_hrly_to_daily.ncl script. Now attached you will also find two .pdf files, where the corresponding full set of data for 2010-07-18 and 2010-07-19 were processed, using the scripts we received. On that note we have two small inquires regarding the results obtained so far:
1. We have observed that the plot scale of ground level o3 varies sometimes from 0 - 80 ppbv to 0 - 90 ppbv. It would be ideal to fix the scale to a specific range of values, say 0 - 90 ppbv for example
2. The o3 mixing ratio is expressed in ppmv, while the actual values are intentionally expressed in ppbv, which is 1000 greater. Would appreciate if the ppmv units could be changed to ppbv units, or if they were erase altogether
Also at this stage we could start gathering the maximum daily o3 values for every month of interest, so as to create an monthly animation month consisting of 30 or 31 .png files. If possible we would appreciate an animation script to visualize the 30 or 31 resulting .png plots in sequential manner, which would represent any specific month of interest.
As before thanks for your help and feedback throughout this process.
Carlos
________________________________
From: Dennis Shea <shea at ucar.edu<mailto:shea at ucar.edu>>
Sent: Friday, August 11, 2017 11:48 AM
To: Bucaram Carbo, Carlos
Subject: Re: [ncl-talk] Daily averaged ozone concentration
This is offline.
Some minor additional changes.
=====
wrf_hrly_to_daily.ncl
The 'description' attribute is quite long. Maybe, it should be shorter ...
o3DayAvg at description = "Surface O3 Mixing Ratio"
or
o3DayAvg at description = "Near Surface O3 Mixing Ratio"
====
plot_o3.ncl
For both loops:
Replace
res at tiMainString = fili+": nt="+nt
With, the more meaningful
date = cd_calendar(x&Time(nt),0)
DATE = toint(date(0,1))+"-"+toint(date(0,2))+"-"+toint(date(0,0)) ; mm-dd-yyyy
res at tiMainString = fili+": "+DATE
====
There is a very good NCL tutorial at:
https://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/
D
On Thu, Aug 10, 2017 at 10:31 PM, Dennis Shea <shea at ucar.edu<mailto:shea at ucar.edu>> wrote:
Sigh!
Apologies ... I attached the wrong scrip/plots
On Thu, Aug 10, 2017 at 9:34 PM, Dennis Shea <shea at ucar.edu<mailto:shea at ucar.edu>> wrote:
re:
fatal:Dimension sizes of left hand side do not match right hand side
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 99 in file wrf_hrly_to_daily.ncl
Line 99: fnc->o3DayAvg = (o3DayAvg)
The (...) should not affect the array. Actually I have no idea why used the (...). I looked at the output and I think the issue is related to the first two lines.
Replace
fnc->Time = Time
fnc->Times = Times ; original character
fnc->XLAT = f[0]->XLAT(0,:,:) ; no 'Time' dimension
fnc->XLONG = f[0]->XLONG(0,:,:)
fnc->o3DayAvg = (o3DayAvg)
With
fnc->o3DayAvg = o3DayAvg ; write meta data associated with daily avg
fnc->XLAT = f[0]->XLAT(0,:,:) ; no 'Time' dimension
fnc->XLONG = f[0]->XLONG(0,:,:)
========
re: the plot
You must look at the data.
The lat/lon arrays are not global yet you have a global plot background. That should provide you with some information to investigate.
WRF files place the necessary graphic projection information with the file attributes.
That is why the WRF file's attributes were copied to the 'o3.day.nc<http://o3.day.nc>' file.
ncl 0> f = addfile("o3.day.nc<http://o3.day.nc>","r")
ncl 1> xlat = f->XLAT
ncl 2> printMinMax(xlat,0)
(0) LATITUDE, SOUTH IS NEGATIVE (degree_north) : min=24.4541 max=52.7485
ncl 3> xlon = f->XLONG
ncl 4> printMinMax(xlon,0)
(0) LONGITUDE, WEST IS NEGATIVE (degree_east) : min=-115.097 max=-74.9647
ncl 5> print(f)
variable: f
Type: file
filename: o3.day
path: o3.day.nc<http://o3.day.nc>
file global attributes:
[snip]
MAP_PROJ_CHAR : Lambert Conformal
MAP_PROJ : 1
...
POLE_LON : 0
POLE_LAT : 90
STAND_LON : -95.031
MOAD_CEN_LAT : 39.072
TRUELAT2 : 39.072
TRUELAT1 : 39.072
CEN_LON : -95.03101
CEN_LAT : 39.072
[snip]
============================================
On Wed, Aug 9, 2017 at 7:22 PM, Bucaram Carbo, Carlos <carlos.bucaramcarbo at und.edu<mailto:carlos.bucaramcarbo at und.edu>> wrote:
HI Dennis,
Thank for your quick reply and feedback. Attached you will see the wrf_hrly_to_daily.ncl script we used to run the full set of data for one day, as well as the small variant we used to run only one 1-hour of data. As you might see from the corresponding wrf_hrly_to_daily.out files, an error occurred when we processed the full 24-hour set of wrfout_d01* files. That error reads as follows:
fatal:Dimension sizes of left hand side do not match right hand side
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 99 in file wrf_hrly_to_daily.ncl
Line 99 of the wrf_hrly_to_daily.ncl reads as follows:
fnc->o3DayAvg = (o3DayAvg)
On another note when we ran the same script to process only one 1--hour wrfout_d01 file, the out file completes the running of the script with no issues. Then the o3.day.nc<http://o3.day.nc> is created correctly, and thus we visualize an image similar to the attached one.
Also we appreciate your advise regarding the commands for the visualization script. We might get to work on that as soon as the 24 1-hour wrfout_d01* gridded o3 concentration values are correspondingly gridded on the daily average 1-frame file.
Once again thanks for your help and feedback on the above issue,
Carlos
________________________________
From: Dennis Shea <shea at ucar.edu<mailto:shea at ucar.edu>>
Sent: Monday, August 7, 2017 7:42:37 PM
To: Bucaram Carbo, Carlos
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] Daily averaged ozone concentration
Your original email had:
"find a script that would read 24 individual 1-hour wrfout_d01* output files for every day of an entire month of the year"
[1]++++++++++++++++++++++++++++++++++++++++++++++
Did anybody look at the .out file?
filw = systemfunc("cd "+dirw+" ; ls wrfout_d01_2010-07-15_*.nc"
pthw = dirw+filw
;---https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
addfiles - University Corporation for Atmospheric Research<https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml>
www.ncl.ucar.edu<http://www.ncl.ucar.edu>
NCL Home > Documentation > Functions > File I/O addfiles. Creates a reference that spans multiple data files. Prototype function addfiles ( file_path [*] : string ...
f = addfiles(pthw, "r") ; 'f' is type list
Times= f[:]->Times ; char Times(Time, DateStrLen)
Times_str= tostring( Times )
print(Times_str)
===========
You only have **one** time step. Likely only one file!
===========
Variable: Times_str
Type: string
Total Size: 8 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1] <========
Coordinates:
(0) 2010-07-15_19:00:00
(0) -----
=====
I provided an outline of how to proceed. The 'file name string' was a place holder for you to change for your needs
You should have used something like the following unix style expansions which NCL understands.
wrfout_d01_2010-*00.nc<http://00.nc> ; all wrfout_d01_2010 files for 2010 that end with 00.nc<http://00.nc>
or
wrfout_d01_2010-0[6-8]*00.nc<http://00.nc> ; all wrfout_d01_2010 files for June-Aug that end with 00.nc<http://00.nc>
or
wrfout_d01_*00.nc<http://00.nc> ; all wrfout_d01 files that end with 00.nc<http://00.nc>
filw = systemfunc("cd "+dirw+" ; ls wrfout_d01_2010-*00.nc<http://00.nc>"
pthw = dirw+filw
print(pthw) ; <====== LOOK at this
f = addfiles(pthw, "r") ; 'f' is type list
Times= f[:]->Times ; char Times(Time, DateStrLen)
Times_str= tostring( Times )
print(Times_str)
exit ;
========
[2]+++++++++++++++++++++++++++++++++++++++++++++++++++++
The netCDF file looks fine. It has only one time step because you provided only one file.
========
[3] I did not provide any graphic code. I speculate you are using some of the code you included with the original post. This included u10/v10 data which was overlaid onto O3. There is no u10/v10 on the daily mean o3 file. If you need a daily mean u10/v10, you will have to add more code to the NCL script. to calculate and output daily mean u10/v10.
The plot code with the original email used: It used the following to plot the o3 value.
plot = wrf_contour(a,wks,o3(nl,:,:),res) ; <=== nl ... level index
===
Your scalar code for o3 would be
a = addfile("o3.day.ncl", "r")
plot = wrf_contour(a,wks,o3(nt,:,:),res) ; nt refers to the daily time index
=================================
ALl of the necessary plot information is on the o3.day.nc<http://o3.day.nc> file as file attributes.
On Mon, Aug 7, 2017 at 5:03 PM, Bucaram Carbo, Carlos <carlos.bucaramcarbo at und.edu<mailto:carlos.bucaramcarbo at und.edu>> wrote:
Hi Dennis,
Thank you for your reply, and comments. We proceeded as you recommended, and then tried to visualize the output on a second NCL script. The end result could be seen on the attached .pdf file. A few thoughts on what we have found out so far:
1. We can process a single wrfout_d01* file at a time, with the Wrf_hrly_to_daily.ncl script. However when we have tried to process a wrfout_d01* file with multiple hours of data, we observe errors on the terminal screen and virtually no data on the resulting o3.day.nc<http://o3.day.nc> netcdf file. Also the script will not read multiple wrfout_d01* single hour data files, and just pick and process the very last hour of such batch of data files.
2. The visual output is very appealing, but it would be desirable to have a visual representation within the domain area of study
Attached you will find the NCL scripts we have used, the resulting o3.day.nc<http://o3.day.nc> netcdf file, as well as the .pdf post-processed image. Also we would be glad to share the wrfout_d01* files we have used so far, through Dropbox, if you think it might help.
As before we do appreciate your help and feedback with this issue.
Best regards,
Carlos
________________________________
From: Dennis Shea <shea at ucar.edu<mailto:shea at ucar.edu>>
Sent: Friday, August 4, 2017 9:23:24 PM
To: Bucaram Carbo, Carlos
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] Daily averaged ozone concentration
After
filAtt = 0
filAtt at title = "O3: Daily Mean"
filAtt at Conventions = "None"
filAtt at creation_date = systemfunc("date")
filAtt at NCL = get_ncl_version()
Add the following line:
copy_VarAtts(f[0], filAtt) ; copy WRF file attributes
Cheers
D
On Fri, Aug 4, 2017 at 7:25 PM, Bucaram Carbo, Carlos <carlos.bucaramcarbo at und.edu<mailto:carlos.bucaramcarbo at und.edu>> wrote:
Hi Dennis,
Thank you for your quick reply. Upon your suggestion we downloaded the pre-compiled binaries of NCl 6.4.0 for our Linux distribution configuration , openSUSE Leap 42.1_x86_64, and thankfully got it to work.
We also used your script and and it work very well to give us an average of the ground level o3 values on a new netcdf file, as well as on the terminal screen. However for some reason the new NCL image appear to revert to polar coordinates, and not to the original Lambert Conformal ones of the original wrfout_d01* file.
Below you will see the message which we received on our terminal screen:
Bucaram at linux-vx3k:~/Documents2/ncl_ncarg-6.4.0.Linux_CentOS7.3_x86_64_nodap_gnu485/bin> ./ncl ozone_script.ncl
Copyright (C) 1995-2017 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.4.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
(0) wrf_map: Error: no MAP_PROJ attribute in input file
It appears that since a map projection is not found on the newly produced o3.day.nc<http://o3.day.nc> file, the NCL post-processed image shows (North) polar coordinates.
Also attached you will find the script as well as the pdf post-processed file from NCL 6.4.0. Please let me know if you think it might be possible to include the original map projection on the post-processed image, so as to visualize the average ground level o3 concentration in the original domain.
Thanks again for your help and best regards,
Carlos
________________________________
From: Dennis Shea <shea at ucar.edu<mailto:shea at ucar.edu>>
Sent: Thursday, August 3, 2017 8:38:11 PM
To: Bucaram Carbo, Carlos
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] Daily averaged ozone concentration
What version of NCL do you have?
The attached script uses a 6.4.0 function: calculate_daily_values
It is untested ... don't have multiple hourly files.
https://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_daily_values.shtml
calculate_daily_values - CISL's NCAR Command Language (NCL)<https://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_daily_values.shtml>
www.ncl.ucar.edu<http://www.ncl.ucar.edu>
NCL Home > Documentation > Functions > General applied math calculate_daily_values. Calculate daily values [avg, sum, min, max] from high frequency temporal values.
On Thu, Aug 3, 2017 at 1:44 PM, Bucaram Carbo, Carlos <carlos.bucaramcarbo at und.edu<mailto:carlos.bucaramcarbo at und.edu>> wrote:
Dear NCL Support,
We are trying to find a script that would read 24 individual 1-hour wrfout_d01* output files for every day of an entire month of the year, then average the individual hourly ground level ozone (o3) concentrations data over each daily 24-hour period (at lowest level nl=0), and write a new netcdf file with an gridded o3 average concentration for that specific day. The end result would be a visual representation of a gridded o3 average concentration for any specific day, if possible.
When searching on previous archives we found the following response to a somewhat similar inquire back in 2011, but we are not sure if it would apply in our case:
https://www.ncl.ucar.edu/Support/talk_archives/2011/1358.html
NCL:
x3 = f->X ; (time,lat,lon) time is 3-hrly
dimx3 = dimsizes(x3)
ntim3 = dimx3(0)
nsd = 8 ; number of samples per day
xday = x3(::nsd,:,:) ; create array with meta data
do nt=0,ntim3-1,nsd
xday(nt/nsd,:,:) = (/ dum_avg_n(nt:nt+nsd-1,:,:) /)
end do
diro = "./" ; output directory
filo = "day.nc<http://day.nc>"
system ("/bin/rm -f "+diro+filo)
fnc = addfile (diro+filo, "c")
filAtt = 0
filAtt at title = "..."
filAtt at Conventions = "None"
filAtt at creation_date = systemfunc("date")
fileattdef( fnc, filAtt ) ; create file attributes
filedimdef(ncdf,"time",-1,True) ; make time UNLIMITED
fnc->XDAY = xday
Also attached you will find the current wrf_ozone.ncl script which we use to post-process each individual 1-hour wrfout_d01* file for o3, as a well as a sample post-processed image for a specific day and hour of 2010.
Any specific direction from your side regarding this issue would be greatly appreciated.
With best regards,
Carlos J. Bucaram
Graduate Research Assistant
University of North Dakota
Department of Chemical Engineering
Harrington Hall Room 223
241 Centennial Dr., Grand Forks, ND
58202-7101
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170814/389cf1ba/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: daily_O3_max__2010-07-18.pdf
Type: application/pdf
Size: 538747 bytes
Desc: daily_O3_max__2010-07-18.pdf
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170814/389cf1ba/attachment-0002.pdf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: daily_O3_max__2010-07-19.pdf
Type: application/pdf
Size: 527952 bytes
Desc: daily_O3_max__2010-07-19.pdf
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170814/389cf1ba/attachment-0003.pdf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrf_hrly_to_daily.ncl
Type: application/octet-stream
Size: 3858 bytes
Desc: wrf_hrly_to_daily.ncl
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170814/389cf1ba/attachment-0003.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrf_hrly_to_daily.out
Type: application/octet-stream
Size: 4197 bytes
Desc: wrf_hrly_to_daily.out
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170814/389cf1ba/attachment-0004.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_max_o3.ncl
Type: application/octet-stream
Size: 4012 bytes
Desc: plot_max_o3.ncl
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170814/389cf1ba/attachment-0005.obj
More information about the ncl-talk
mailing list