JGCRI / hector

The Hector Simple Climate Model
http://jgcri.github.io/hector/
GNU General Public License v3.0
107 stars 45 forks source link

Values for 1745/1746 #735

Open rgieseke opened 4 months ago

rgieseke commented 4 months ago

There have been a few issues about this already (e.g. #354, #556, #177)

The documentation currently states:

An important note about time: The outputstream code currently writes the end date of the current timestep in the outputstream.csv file; e.g., when we’re running 1 January 1745 - 31 December 1745, what gets written is “1746”. This is not intuitive (most people think of “1746” denoting January 1-December 31) but numerically correct: the date is 1746.0, i.e. midnight on December 31 1745. A consequence is that carbon fluxes logged at this timepoint are effectively for the calendar year 1745 (1745-01-01 to 1745-12-31).

https://jgcri.github.io/hector/articles/outputstream.html?#output-stream-categories

As discussed in the linked issues, for NBP (formerly 'atm_land_flux') in simpleNbox it's not possible to retrieve a value for 1745 using RHector.

packageVersion("hector")

‘3.2.0’

core <- newcore('hector_ssp126.ini')

fetchvars(core, 1745:2100, vars = c(NBP()))

Error: sendmessage: msg:    Interpolation requested but not allowed (?) date: 1745

func:   get
file:   tseries.hpp
ffile:  ../inst/include/tseries.hpp

line:   332

With

fetchvars(core, 1746:2100, vars = c(NBP()))

I get (as expected and documented):

fetchvars(core, 1746:2100, vars = c(NBP()))
               scenario year variable         value   units
1   Unnamed Hector core 1746      NBP -0.0802025172 Pg C/yr
2   Unnamed Hector core 1747      NBP -0.0762544017 Pg C/yr

However, in the command line outputstream I do get a value for 1745:

# Output from hector version 3.2.0 on Mon Feb 26 15:22:42 2024
year,run_name,spinup,component,variable,value,units
1745,ssp119,1,simpleNbox,NBP,0.0009932,Pg C/yr
1746,ssp119,0,simpleNbox,NBP,-0.0802,Pg C/yr
1747,ssp119,0,simpleNbox,NBP,-0.07625,Pg C/yr

For the Pyhector v3 update (https://github.com/openclimatedata/pyhector/pull/63) I need to find a way to handle NBP not reporting for 1745, which in my current setup requests all years for all variables and errors with the same error as RHector above . I can surely work around this somehow, but was wondering why the command line version reports a value for 1745. Also, is NBP the only value for which the start year (1745) is not being reported?

[Edited: I had 1746 in some places instead of 1745, sorry!]

rgieseke commented 4 months ago

FWIW, @swillner figured out that if we request the simpleNbox.NBP data without a date we can get the data without an error with Pyhector, the same as in the command line Hector outputstream.

In [2]: pyhector.run(pyhector.ssp126, outputs=["simpleNbox.NBP"])
Out[2]: 
      simpleNbox.NBP
1745        0.000993
1746       -0.080203
1747       -0.076254
1748       -0.073284

I am still a bit confused about whether and when the 1745 data makes sense to report or whether it should be discarded as part of spin-up.