TNC-NMFO / NWLAND

carbon accounting model
0 stars 0 forks source link

climate scalars reporting no deviation from current (i.e. all scalars == 1) #87

Closed sbassett closed 2 years ago

sbassett commented 2 years ago

This preprocessing script is frustrating me. I propose we reach out to Alan on this one. in https://github.com/TNC-NMFO/NWLAND/blob/nwland_dev_withWLIC/preproc/NWLAND_proc_iesm_climate_v4.r

runs but produces scalars with zero variation:

/preproc/scalarTesting/nwland_climate_c_scalars_iesm_rcp85_test.csv

I will trace back the steps and investigate where the values became 1.

Hypotheses:

  1. lc_vals[which(is.nan(lc_vals))] = 1 is setting all the values (e.g. lines 743, 758, 789, 800)
  2. Floats are converted to integers rounding to 1.
  3. Years are not incrementing correctly so when compared to itself there is no change.
sbassett commented 2 years ago

Hypothesis 1 has not yet been rejected. If (line 756):

> head(scalar_lc[,2][lt_inds])
116002 116003 116004 116006 116007 116008 
   NaN    NaN    NaN    NaN    NaN    NaN 

Then: lc_vals[which(is.nan(lc_vals))] = 1 will make these values = 1.

aj1s commented 2 years ago

Running script on small extent raster extracted from "landcat_2021_10_04_integer.tif". Will look for where NaNs (0/0) are being generated. Ref: https://stats.stackexchange.com/questions/5686/what-is-the-difference-between-nan-and-na

If to no avail, then agreed: let's try Alan.

sbassett commented 2 years ago

Am using a manual approach to get climate scalars. See #89