Skip to content

Fix bugs in reporting for forcings.#303

Merged
rplzzz merged 7 commits intomasterfrom
krd_RF_H2O
May 4, 2019
Merged

Fix bugs in reporting for forcings.#303
rplzzz merged 7 commits intomasterfrom
krd_RF_H2O

Conversation

@kdorheim
Copy link
Contributor

@kdorheim kdorheim commented May 2, 2019

Change the bindings between R and C++ code so that the RF_H2O() refer to H2O RF.

@kdorheim kdorheim requested a review from rplzzz May 2, 2019 16:56
@rplzzz rplzzz added the WIP label May 2, 2019
Copy link
Contributor

@rplzzz rplzzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far. Since we're still seeing a discrepancy in the forcing totals, I've tagged it as WIP until we track down the source. If it's another minor fix, we can roll it in with this PR.

@rplzzz rplzzz requested a review from cahartin May 2, 2019 21:58
The halocarbon forcings are supplied by the halocarbon components, not
the forcing component, and the former do not know how to correct their
values to be relative to the base year.  To rectify this, we've added
a new set of capabilities for adjusted halocarbon forcings, which are
reported by the forcing component and given relative to the base
year.

The R interface has been changed to report the adjusted forcings
whenever halocarbon forcings are asked for.  There is no provision for
getting the unadjusted halocarbon forcings in R because Hector does
not provide unadjusted forcings for other GHGs, and so there isn't
really anything you can do with the unadjusted halocarbon values.
@rplzzz rplzzz removed the WIP label May 2, 2019
@rplzzz
Copy link
Contributor

rplzzz commented May 2, 2019

@kdorheim I can't add you as a reviewer, since this is originally your PR, but if you would, please, take a look at my changes (you might want to filter to just the commit that I added), and let me know if you see anything that could use some improvement.

@rplzzz rplzzz changed the title RF_H2O Fix bugs in reporting for forcings. May 2, 2019
@rplzzz
Copy link
Contributor

rplzzz commented May 2, 2019

The code won't build with GCC because I used a C++-11 feature, and g++ is configured to do C++-0x compatibility. That should be an easy fix to the makefile.

I'm not sure why the R build succeeds, whether it's because w'ere using clang on the travis R build, or whether the default flags for g++ are different under Rcpp. Either way, while we're at it, we should probably configure the Rcpp build explicitly to specify C++-11. We've ben getting compiler warnings about C++-11 features the whole time, and we wouldn't want someone's build to fail because their compiler didn't get the memo.

I probably won't get to any of this until after my telecon tomorrow afternoon. In the meantime, this branch should be usable, just not quite ready to merge.

Addendum: It looks like the R build on Appveyor is also failing because of this, so we definitely need to update the standard flags in the Rcpp build.

@ashiklom
Copy link
Contributor

ashiklom commented May 3, 2019

configure the Rcpp build explicitly to specify C++-11

I think the recommended way to do this is to add the following line to the src/Makevars file:

CXX_STD = CXX11

easy fix to the makefile

I think this is just a matter of adding -std=c++11 to the end of the CXXFLAGS list in src/makefile.standalone. Though my understanding of exactly which variables control what in the C compilation process is a bit hazy, so I defer to the experts.

@rplzzz
Copy link
Contributor

rplzzz commented May 4, 2019

Well, on the windows side we still get warnings about C++-11 features, but at least it builds. I guess any compile you can walk away from is a good one.

On the mac R builds we're now building cleanly, with no warnings at all, so I'm calling this a win.

@rplzzz rplzzz self-requested a review May 4, 2019 08:38
Copy link
Contributor

@rplzzz rplzzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think everything appears to be in order; however, since I added some of the changes here, it really should have another pair of eyes on it before we merge.

Copy link
Member

@bpbond bpbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine generally but worth considering nomenclature.

Replace "adjusted" with "relative", where feasible.
@rplzzz rplzzz merged commit fddfed5 into master May 4, 2019
@rplzzz rplzzz deleted the krd_RF_H2O branch May 4, 2019 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants