> On Aug. 24, 2013, 5:47 p.m., Michael Joyce wrote: > > http://svn.apache.org/repos/asf/incubator/climate/trunk/ocw/dataset.py, > > lines 152-166 > > <https://reviews.apache.org/r/13738/diff/1/?file=343842#file343842line152> > > > > We could define err_msg before the if-statements and then check later > > if it's set and raise an error from there. Might clean this up a bit. > > Similarly we could chain all the if's together into one if-elif. But then > > again this is really just me spouting my personal preferences. > > > > Something like this is what I'm talking about: > > > > err_msg = None > > lat_count = lats.shape[0] > > lon_count = lons.shape[0] > > time_count = times.shape[0] > > > > if lat_dim != 1: > > err_msg = "blah" > > elif lon_dim != 1: > > err_msg = "blah" > > ... > > elif values.shape != (time_count, ...): > > err_msg = "blah" > > > > if err_msg: > > raise ValueError(err_msg)
+1, makes sense. If we're going to catch the exception might as well pass the message with it. - Chris ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/13738/#review25505 ----------------------------------------------------------- On Aug. 22, 2013, 3:15 p.m., Cameron Goodale wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/13738/ > ----------------------------------------------------------- > > (Updated Aug. 22, 2013, 3:15 p.m.) > > > Review request for Apache Open Climate and Michael Joyce. > > > Bugs: CLIMATE-274 > https://issues.apache.org/jira/browse/CLIMATE-274 > > > Repository: climate > > > Description > ------- > > I created 5 different ValueError exception error messages for each different > check we perform when a Dataset object is initialized. > > > Diffs > ----- > > http://svn.apache.org/repos/asf/incubator/climate/trunk/ocw/dataset.py > 1516193 > > Diff: https://reviews.apache.org/r/13738/diff/ > > > Testing > ------- > > I re-ran test_dataset.py and all 23 tests pass. > > > Thanks, > > Cameron Goodale > >
