Skip to content

Conversation

@xylar
Copy link
Collaborator

@xylar xylar commented Mar 25, 2017

Add a function to update the startYear and endYear config options based on the start and end of a climatology data set. A warning is issued if the start and end years are different from those requested by the user.

All analysis tasks for computing climatologies now use this function to make sure plot titles and file names use the start and end years of the data set (as opposed to those requested in the config file). The MOC cache file name now uses the actual start and end years as well.

@xylar
Copy link
Collaborator Author

xylar commented Mar 25, 2017

@milenaveneziani, this is an implementation of your suggested fix to #149 for the MOC.

@xylar
Copy link
Collaborator Author

xylar commented Mar 25, 2017

Testing

I tested this with the QU240 test case. As expected, the file names for the MOC cache files and plots now end at year 2 even when I have the end year set to 50 in the config file.

@milenaveneziani
Copy link
Collaborator

great, @xylar, thanks.
One thing I was thinking: should we issue a warning when the real startYear,endYear are different from the intended ones? So that we make sure the user knows about it?

@xylar
Copy link
Collaborator Author

xylar commented Mar 25, 2017

Yes, that's a very good idea. I implemented that and am testing it now.

@xylar xylar changed the title Update start and end dates from MOC climatology data set Update start and end dates from climatology data set; issue a warning Mar 25, 2017
@xylar
Copy link
Collaborator Author

xylar commented Mar 25, 2017

Seems to behave as expected:

/home/xylar/code/mpas-work/analysis/fix_end_date_moc/mpas_analysis/shared/climatology/climatology.py:523: UserWarning: climatology start and/or end year different from requested
requestd: 0001-0050
actual:   0001-0002

@xylar
Copy link
Collaborator Author

xylar commented Mar 25, 2017

Note: the warning will only occur once, since the start and end years have been updated in config for subsequent analysis tasks (and eventually once #128 is merged for writing out the config as provenance).

@milenaveneziani
Copy link
Collaborator

very nice, thanks @xylar!
as soon as you rebase and solve the conflicts, I will give this a quick test and merge.

xylar added 2 commits March 26, 2017 11:18
After reading in a data set, set the real start and end years
based on the data read in.
A new function is added to climatology to update the climatology
start and end years to match those of a data set.  If the start
and/or end year are changed, a warning is issued and the config
options are updated.
@xylar xylar force-pushed the fix_end_date_moc branch from ad46095 to 20a6294 Compare March 26, 2017 09:23
@xylar
Copy link
Collaborator Author

xylar commented Mar 26, 2017

Thanks @milenaveneziani. I just rebased and fixed the conflict.

@milenaveneziani milenaveneziani merged commit 20a6294 into MPAS-Dev:develop Mar 27, 2017
@milenaveneziani
Copy link
Collaborator

@xylar: I have tested this on edison with a newer beta1 run for which I only had 25 years of data available. I requested climos for year 1-60, and everything worked out as expected.
One thing I noticed: the warning message includes the last line of the python code that issues the warning ( endYear)) for this case). Apparently this is expected, although weird to see. But it is not a big deal, so I decided to merge anyway. It could be fixed in a subsequent PR (doesn't have to be a dedicated PR in my opinion), if one finds a way to fix it.
Here is the full warning message I saw:

/global/u2/m/milena/MPAS-git-repositories/MPAS-Analysis/mpas_analysis/shared/climatology/climatology.py:523: UserWarning: climatology start and/or end year different from requested
requestd: 0001-0060
actual:   0001-0025

  endYear))

@xylar xylar deleted the fix_end_date_moc branch March 27, 2017 07:07
@xylar
Copy link
Collaborator Author

xylar commented Mar 27, 2017

Thanks, @milenaveneziani. I hadn't noticed the weird end of the warning message. The fix might be just to have a very long line for that warning...

@xylar
Copy link
Collaborator Author

xylar commented Mar 27, 2017

Basically, I think this is the expected behavior. I'm a little surprised python doesn't print all lines from warning.warn( to endYear)) but there doesn't seem to be an easy way to make it do that. What one could do is suppress printing the line, but I don't know how to do that for one warning, as opposed to all warnings.

@milenaveneziani
Copy link
Collaborator

yeah, I noticed that too. I think if you don't have carriage returns in the line, then it will print the whole line.
Anyways, let's not worry about it now.

@xylar xylar mentioned this pull request Mar 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants