[
https://issues.apache.org/jira/browse/CLIMATE-786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15265200#comment-15265200
]
ASF GitHub Bot commented on CLIMATE-786:
----------------------------------------
GitHub user jarifibrahim opened a pull request:
https://github.com/apache/climate/pull/336
CLIMATE-786 - Update rcmed.py and test_rcmed.py
- Update rcmed.py file
- Fix test_rcmed.py file
Function `test_function_parameter_dataset_lats_monthly` is added to improve
test coverage.
Fixes https://issues.apache.org/jira/browse/CLIMATE-786
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jarifibrahim/climate CLIMATE-786
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/climate/pull/336.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #336
----
commit 436c170e887ce724654b6d2c851566884845e9f2
Author: Ibrahim <[email protected]>
Date: 2016-04-30T06:27:53Z
CLIMATE-786 - Update rcmed.py and test_rcmed.py
- Update rcmed.py file
- Fix test_rcmed.py file
Fixes https://issues.apache.org/jira/browse/CLIMATE-786
----
> Update rcmed.py and test_rcmed.py
> ---------------------------------
>
> Key: CLIMATE-786
> URL: https://issues.apache.org/jira/browse/CLIMATE-786
> Project: Apache Open Climate Workbench
> Issue Type: Bug
> Components: data sources, tests
> Reporter: Ibrahim Jarif
> Assignee: Ibrahim Jarif
> Priority: Critical
> Labels: test
> Fix For: 1.1
>
>
> There are multiple issues here
> 1. The {code}if time.day != last_day_of_month:{code} on line 3 is incorrect.
> It should be{code}if time_step == 'monthly':{code} . Fixing this creates
> another bug. Read 2.
> {code}
> def _end_of_date(time, time_step):
> last_day_of_month = calendar.monthrange(time.year, time.month)[1]
> if time.day != last_day_of_month:
> end_time_string = time.strftime('%Y%m%d')
> end_time_string = end_time_string[:6] + str(last_day_of_month)
> time = datetime.strptime(end_time_string, '%Y%m%d')
> ##TODO: Change the 3 lines above with this line:
> ##time = datetime(time.year, time.month, lastDayOfMonth)
> elif time_step.lower() == 'daily':
> end_time_string = time.strftime('%Y%m%d%H%M%S')
> end_time_string = end_time_string[:8] + '235959'
> time = datetime.strptime(end_time_string, '%Y%m%d%H%M%S')
> ##TODO: Change the 3 lines above with this line:
> ##time = datetime(time.year, time.month, end_time.day, 23, 59, 5
> {code}
> 2. Multiple tests in test_rcmed.py start failing when 1. is fixed. The bug is
> on this line {code}def return_text(self, url):
> if url == self.url +
> "datasetId={0}¶meterId={1}&latMin={2}&latMax={3}&lonMin={4}&lonMax={5}&timeStart=20020801T0000Z&timeEnd=20021031T0000Z"\
> .format(self.dataset_id, self.parameter_id, self.min_lat,
> self.max_lat, self.min_lon, self.max_lon, self.start_time_for_url,
> self.end_time_for_url):{code} This line expects the
> {code}timeEnd=20021031T0000Z{code} but the actual value is
> {code}timeEnd=20021001T2359Z{code}. The value of timeEnd depends on
> {code}time_step{code} variable that is passed on from function to function.
> In the rcmed_test the value of {code}time_step='daily'{code} and hence the
> value of {code}timeEnd{code} should be {code}20021001T2359Z{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)