Skip to content

Update start and end dates from climatology data set; issue a warning - #157

Merged
milenaveneziani merged 2 commits into
MPAS-Dev:developfrom
xylar:fix_end_date_moc
Mar 27, 2017
Merged

Update start and end dates from climatology data set; issue a warning#157
milenaveneziani merged 2 commits into
MPAS-Dev:developfrom
xylar:fix_end_date_moc

Conversation

@xylar

@xylarxylar commented Mar 25, 2017

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
CollaboratorAuthor

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

@xylar

Copy link
Copy Markdown
CollaboratorAuthor

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
Copy Markdown
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
Copy Markdown
CollaboratorAuthor

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

@xylarxylar changed the title Update start and end dates from MOC climatology data setUpdate start and end dates from climatology data set; issue a warningMar 25, 2017
@xylar

Copy link
Copy Markdown
CollaboratorAuthor

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
Copy Markdown
CollaboratorAuthor

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
Copy Markdown
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

Copy link
Copy Markdown
CollaboratorAuthor

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

@milenaveneziani
milenaveneziani merged commit 20a6294 into MPAS-Dev:developMar 27, 2017
@milenaveneziani

Copy link
Copy Markdown
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
Copy Markdown
CollaboratorAuthor

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
Copy Markdown
CollaboratorAuthor

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
Copy Markdown
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.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@xylar@milenaveneziani