# AQ\_Stats\_Plots not working, other spatial plots do work

**URL:** <https://forum.cmascenter.org/t/aq-stats-plots-not-working-other-spatial-plots-do-work/5535>\
**Category:** AMET\
**Tags:** cmaq\
**Created:** [January 20, 2025, 10:06pm UTC](https://forum.cmascenter.org/t/aq-stats-plots-not-working-other-spatial-plots-do-work/5535 "2025-01-20T22:06:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gpara35](https://avatars.discourse-cdn.com/v4/letter/g/76d3ee/32.png) [@gpara35](https://forum.cmascenter.org/u/gpara35)\
**Post date:** [January 20, 2025, 10:06pm UTC](https://forum.cmascenter.org/t/aq-stats-plots-not-working-other-spatial-plots-do-work/5535/1 "2025-01-20T22:06:27Z")

</div>

Hi,

I’m using the most recent version of AMET. I downloaded only AQS data for April, 2017 and used the combine and sitecmp tools in CMAQ to create a merged csv file for AMET use. I’m running AMET without the database (with modifications from this thread: [How to use AMET without mySQL? - #12 by qluo](https://forum.cmascenter.org/t/how-to-use-amet-without-mysql/889/12) ) and was able to run the spatial plots, but I am getting an error in the stat plots that is confusing. See the screenshot:

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/a/a9476fa82461b4ba7ca505220be15f33d4f17a13.jpeg)

This file definitely exists and is the file that is used in the other Spatial plots I’ve generated. The multi\_network\_stats\_data.csv file is created in the plots output but there are no pngs or pdfs. Below are the run/config files I’ve modified and the log output. Any help is appreciated, and if possible I’d like to avoid using the database.

In addition, AMET takes a long time to run, about 15+ minutes just to generate Spatial plots for O3. Is this normal? I’ll likely be using it a lot more for several different species over several months of data.

[aqProject\_pre\_and\_post.csh](https://forum.cmascenter.org/uploads/short-url/yjLqosXh6KMB94N6DjJlB4X7X1t.csh) (32.6 KB)  
[AMET\_batch.input.txt](https://forum.cmascenter.org/uploads/short-url/1pl9XdfqUk5xUdRnTLo4QOhIvpp.txt) (13.2 KB)  
[Run\_Spatial\_Plots\_All\_Batch.Rout.txt](https://forum.cmascenter.org/uploads/short-url/zyVQu9umb4KXdFbqM1o5OGRjCEx.txt) (70.9 KB)

Thanks,  
Grant

---

<div class="post-metadata">

**Author:** ![manishsoni](https://avatars.discourse-cdn.com/v4/letter/m/c2a13f/32.png) [@manishsoni](https://forum.cmascenter.org/u/manishsoni)\
**Post date:** [January 21, 2025, 4:03pm UTC](https://forum.cmascenter.org/t/aq-stats-plots-not-working-other-spatial-plots-do-work/5535/2 "2025-01-21T16:03:32Z")

</div>

Hi Grant,  
I checked your log in [Run\_Spatial\_Plots\_All\_Batch.Rout.txt.  
I found some interesting thing.  
I guess you are doing the AMET evaluation for 2006.

> #start\_date ← “20060101” # Set the start date of the analysis  
> #end\_date ← “20061231” # Set the end date of the analysis  
> If you look at the log you see the observations time period it is looking for  
> [1] " and s.stat\_id=d.stat\_id and d.ob\_dates \>= 20170401 and d.ob\_datee \<= 20170430 and ( d.ob\_dates between 20170401 and 20170430 and d.ob\_datee between 20170401 and 20170430 )" is from 1st April to 30th April 2017. Can you please check and confirm your settings.

---

<div class="post-metadata">

**Author:** ![gpara35](https://avatars.discourse-cdn.com/v4/letter/g/76d3ee/32.png) [@gpara35](https://forum.cmascenter.org/u/gpara35)\
**Post date:** [January 21, 2025, 4:26pm UTC](https://forum.cmascenter.org/t/aq-stats-plots-not-working-other-spatial-plots-do-work/5535/3 "2025-01-21T16:26:37Z")

</div>

I think those lines are commented out and shouldn’t affect things. I am running over the month of April and was able to get results from other Spatial plots like difference. I mostly want to be able to generate spatial plots of mean bias.

---

<div class="post-metadata">

**Author:** ![wyat.appel](https://avatars.discourse-cdn.com/v4/letter/w/3d9bf3/32.png) [@wyat.appel](https://forum.cmascenter.org/u/wyat.appel)\
**Post date:** [January 21, 2025, 5:06pm UTC](https://forum.cmascenter.org/t/aq-stats-plots-not-working-other-spatial-plots-do-work/5535/4 "2025-01-21T17:06:57Z")

</div>

Grant,

I’ve confirmed I can reproduce your error. So, I’ll see if I can diagnose what’s going on. I don’t often use AMET without the database, so it might take me a little bit longer to figure out. But, hopefully, it’s something fairly simple. I’ll let you know when I have a solution.

Wyat

---

<div class="post-metadata">

**Author:** ![wyat.appel](https://avatars.discourse-cdn.com/v4/letter/w/3d9bf3/32.png) [@wyat.appel](https://forum.cmascenter.org/u/wyat.appel)\
**Post date:** [January 21, 2025, 8:30pm UTC](https://forum.cmascenter.org/t/aq-stats-plots-not-working-other-spatial-plots-do-work/5535/5 "2025-01-21T20:30:46Z")

</div>

Grant,

I believe I’ve tracked down the source of the error. The fix is addition of the definition of “stat\_id\_noPOC” in the AQ\_Misc\_Functions.R script.

In your AMET installation directory, in the R\_analysis\_code directory, you’ll need to edit the AQ\_Misc\_Functions.R script to add the missing line. In the AQ\_Misc\_Functions.R script, in the definition for the “read\_sitex” function you’ll find the following line toward the end of the function (aorund line # 1381 in the AMETv1.5 code):

sitex\_data.df$stat\_id ← paste(sitex\_data.df$stat\_id,sitex\_data.df$POCode,sep=‘’)

Right above that line, please add the following line:

sitex\_data.df$stat\_id\_noPOC ← sitex\_data.df$stat\_id

Save the file. That’s all you’ll need to do in the AQ\_Misc\_Functions.R file.

Once you make that change you should be able to successfully run the AQ\_Stats\_Plots.R script. The change to the AQ\_Misc\_Functions.R script may also fix other errors you may encounter with other scripts.

Let me know if you the following change fixes the error you are having. Thanks.

Wyat

---

<div class="post-metadata">

**Author:** ![gpara35](https://avatars.discourse-cdn.com/v4/letter/g/76d3ee/32.png) [@gpara35](https://forum.cmascenter.org/u/gpara35)\
**Post date:** [January 22, 2025, 7:30pm UTC](https://forum.cmascenter.org/t/aq-stats-plots-not-working-other-spatial-plots-do-work/5535/6 "2025-01-22T19:30:12Z")

</div>

Thank you Wyat, that worked. Do you think it would be worth setting up the database if my main use case is to do comparisons like this?

---

<div class="post-metadata">

**Author:** ![wyat.appel](https://avatars.discourse-cdn.com/v4/letter/w/3d9bf3/32.png) [@wyat.appel](https://forum.cmascenter.org/u/wyat.appel)\
**Post date:** [January 23, 2025, 3:43pm UTC](https://forum.cmascenter.org/t/aq-stats-plots-not-working-other-spatial-plots-do-work/5535/7 "2025-01-23T15:43:51Z")

</div>

Grant,

Glad to hear it’s working.

Regarding the use of the database, it’s up to you and is probably somewhat determined by what types of analysis you ultimately want to do. There’s obviously some overhead to getting the MySQL database installed and setup for AMET on your system, but it does provide a great deal of power to tailor analyses. The database allows you to more easily subset your data (e.g., by date, region, obs/model values) and do comparisons between multiple simulations and, in my opinion, makes it much easier to organize and access a large number of simulations.

So, it really comes down to what you want to do. If you envision using AMET for numerous model simulations going forward, it may be worth it to you. If you’re just trying to get basic statistics and plots for a couple of simulations, than working directly from the csv files may be sufficient.

I’m happy to discuss further with you about if you want. We can take that conversation offline. Just let me know.

Wyat

---

<div class="post-metadata">

**Author:** ![rgilliam](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.cmascenter.org/rgilliam/32/65_2.png) [@rgilliam](https://forum.cmascenter.org/u/rgilliam)\
**Post date:** [January 23, 2025, 8:14pm UTC](https://forum.cmascenter.org/t/aq-stats-plots-not-working-other-spatial-plots-do-work/5535/8 "2025-01-23T20:14:58Z")

</div>

I’d throw in the question of how much control do you have over your system as in root access?

If you do, setting up a mysql database on most top linux distros is quite simple. I’ve done it multiple times recently on a home linux network for my personal business and on AWS for AMET. Literally a few steps.
