**Error** Invalid time window defined, start_time > end_time in AMET

Hello,
I am trying to run a AMET script for winter season (December to February)
start date : 2016-12-01
end date : 2016-02-29

When I run this script I get the error "
*** ERROR ABORT in subroutine GET_ENVS
Error Invalid time window defined, start_time > end_time

While I understand why the error occurs, But I couldn’t figure out how do I run for WINTER SEASON in one single AMET run.

Could anyone suggest me how to use start time and end time?

Thanks

You probably want December 2015 through February 2016, I think.

Hi @cjcoats
My CAMx output file (combine output file)


has data from Jan 2016 to Dec 2016. So, I want model statistics for Dec 2016, Jan 2016, and Feb 2016 in one single AMET run.

Then (assuming you’re using I/O API data) use two m3tshift runs first: Shift Dec 2016 back a year, so that the output file has Dec. 2015 dates&times. Then do a second run, copying Jan-Feb 216 onto that output file.
That will create a “fake” output file with the data you want.

1 Like

Hi,

You can process the data from January to December 2016 through AMET and put the entire year into a single AMET database project. AMET then stores the numeric month of each record as a separate field in the project table. From that field, you can create any “season” you want. For example, the additional query statement of

“and (d.month = 12 or d.month =1 or d.month = 2)” would yield a season consisting of December, January and February of any year(s) in the project table. So, from this query you can create a season of December 2016, January 2016, and February 2016. Note again this assumes that your data are loaded into an AMET database project.

Let me know if you need further clarification or if you have other questions. Thanks.

Wyat

2 Likes

Hello @wyat.appel ,
Thank you so much for the response. I am so sorry that I couldn’t find out where exactly I need to make that change. I am using AMET1.4 where I have these folders

I already created a database for the whole year using
/scripts_db/aqExample/
Final_yr2016_aqProject_post_only.txt (7.2 KB).

Where exactly I should add that additional query statement?

Good question, and sorry for not explaining further in my previous response. You can add your own AMET query elements using the environment variable AMET_ADD_QUERY. If you look at the run_timeseries.csh script in the $AMETBASE/scripts_analysis/aq_example/ directory you’ll see a couple of examples of the AMET_ADD_QUERY variable, which are commented out by default.

For any script you wish to apply additional query elements, you can add the AMET_ADD_QUERY environment variable.

To create a season consisting of just December, January and February, it would look like this:

setenv AMET_ADD_QUERY "and (d.month=12 or d.month=1 or d.month=2)"

That will tell AMET to only return data with a month of 12, 1, or 2 (December, January, or February).

Let me know if you run into any issues trying this environment setting.

Wyat

3 Likes

Thank you so much. It works perfectly.

1 Like

Hello, I have the same question: the time windwow defineding doesn’t work. From your detailed reply, I know i need to make the AMET_ADD_QUERY work. I have tried this in the run_timeseries.csh, but it doesn’t work. I only get the time series for all the data.
image

Hi,

One possibility is that while you are setting the AMET_ADD_QUERY environment variable correctly, it is not be further read in by AMET.

The AMET_ADD_QUERY variable is assigned to the “add_query” variable in the all_scripts.input file. In your run_timeseries.csh script you should see the following line near the bottom of the script.

setenv AMETRINPUT $AMETBASE/scripts_analysis/$AMET_PROJECT/input_files/all_scripts.input

If you look at the all_scripts.input file, you should see the following line.

add_query ← Sys.getenv(“AMET_ADD_QUERY”)

I suspect that the line above is either missing or commented out in your all_scripts.input file. That’s the first place to check. If you confirm that your all_scripts.input file has the line above uncommented, then we will need to further diagnose where the problem is occurring.

If the above fix does not work, could you please attach your run_timeseries.csh script and all_scripts.input file to your reply. That will be helpful for figuring out what’s happening. Thanks!

Wyat

Thanks for your detailed reply. The AMET_ADD_QUERY environment variable has been set, but it doesn’t work well. The following is the run_timeseries.csh script and all_scripts.input file. Thanks very much!
run_timeseries.csh (5.8 KB)
all_scripts.input.csh (7.6 KB)

Hi,

I see the issue now. The AMET_ADD_QUERY only works when you’re retrieving data from the database, which means the AMET_DB environment variable must be set to T. In your run_timeseries.csh script the AMET_DB variable is to F, so the additional querying option will not work. If you loaded your data into the database, please set AMET_DB to T and see if the additional month criteria works to subset the data.

If you’re not using the database option and simply reading the .csv files directly, you won’t be able to invoke the additional options to subset the data.

Let me know if that solution works for you. If not, we can discuss other options you have available if you’re not using the database capability of AMET. Thanks!

Wyat

1 Like

Thanks for your detailed reply. it is very useful for me. But because i must use AMET in our sevice platform, which is not allowed to usd the MySQL, so i must read the .csv files directly. So i won’t be ablue to invoke the additional options. I wonder the problem would be considered in future updates?
Thank you very much! Best wished!

Yes, unfortunately the options available when reading the site compare files directly are currently limited. I know it’s more work, but you could subset the csv files yourself by month and read in the subset data instead of the full dataset. Obviously that’s not ideal, but it would work.

I would like to increase the ability to select data when reading the csv files directly. This is certainly possible, since once the data are read into R they can easily manipulated. Unfortunately, I’ve not had time to implement such capabilities yet. I will try to add at least this simple time sub setting as a capability when reading the csv files directly, since that is generally the most widely used type of data sub setting.

Hopefully you are still finding AMET useful for your needs, and I appreciate you reaching out with your needs. Best of luck!

Wyat

2 Likes