NWTlter / NWT_CLM

Workflow scripts for running point simulations of CLM at Niwot Ridge using Tvan forcing data
1 stars 7 forks source link

Plotting questons #9

Closed wwieder closed 3 years ago

wwieder commented 4 years ago

Several plotting questions that likely need to be addressed elsewhere, but that I'll start a list of here:

diel plots

seasonal daily mean plots

seasonal or annual plots? are these coming?

More broadly, this makes me wonder how to begin troubleshooting code down the road?

How do we add multiple vegetation types into the analysis?

https://github.com/hhollandmoritz/NWT_CLM/blob/5514b7f1ad8739da459688c67957f142b9713e0e/Obs_sim_comp_plots.R#L110

wwieder commented 4 years ago

image

wwieder commented 4 years ago

image

hhollandmoritz commented 3 years ago

I added in a diel plotting step. You're right GPP is totally wacky. I think it's because I'm probably not converting it's units properly in flow.obs.R. I think you mentioned something about needing to divide it by some factor to be model comparable. I'm pretty sure I haven't done that.

I think the best place to put that calculation would be somewhere between line 308 and 324 of flow.obs.R. Before the diurnal and DoY fluxes are calculated. GPP is originally derived from the ReddyProc steps in flow.lter.clm.R

image

hhollandmoritz commented 3 years ago

For the problem of masking out soil moisture. I did try to do that in my original calculations of the soil moisture in flow.obs.R but I think I masked before I averaged everything to the correct time scale. So some borderline values sneak through. Probably the easiest solution would be to mask out the values post averaging as well. Currently the ineffective masking is being done on lines 635-638 of flow.obs.R

wwieder commented 3 years ago

Unit conversion from flux tower observations (umol/m2/s) are now the same as the model (gC/m2/s) image

wwieder commented 3 years ago

@hhollandmoritz I'm not smart enough to understand what you're doing to plot snow depth, but it looks like only one vegetation community is being plotted for the model (FF and DM have much lower snow depth in the model).

image

hhollandmoritz commented 3 years ago

I'm sure it's nothing to do with intelligence and everything to do with poor commenting on my part and a bug on top of that. :)

Looking at the code I found the error. In lines 255-261 I calculate the averages and standard deviations of the simulated snow depth for every date. But I forgot to also calculate the averages separately for each vegetation community. Instead it was averaging across all vegetation communities at every date.

The fix is simple, we just need to add veg_com to the group_by() statement so that it looks like the code below:

snow_depth.clm <- all.clm %>% 
  select(date, SNOW_DEPTH, veg_com, ObsSim) %>%
  group_by(date, veg_com) %>%
  mutate(avg_snwdp = mean(SNOW_DEPTH, na.rm = TRUE),
         sd_snwdp = sd(SNOW_DEPTH, na.rm = TRUE)) %>%
  select(-SNOW_DEPTH) %>%
  unique()

Sorry for the confusion!

wwieder commented 3 years ago

that's it!

On Fri, Oct 2, 2020 at 5:01 PM Hannah Holland-Moritz < notifications@github.com> wrote:

I'm sure it's nothing to do with intelligence and everything to do with poor commenting on my part and a bug on top of that. :)

Looking at the code I found the error. In lines 255-261 I calculate the averages and standard deviations of the simulated snow depth for every date. But I forgot to also calculate the averages separately for each vegetation community. Instead it was averaging across all vegetation communities at every date.

The fix is simple, we just need to add veg_com to the group_by() statement so that it looks like the code below:

snow_depth.clm <- all.clm %>% select(date, SNOW_DEPTH, veg_com, ObsSim) %>% group_by(date, veg_com) %>% mutate(avg_snwdp = mean(SNOW_DEPTH, na.rm = TRUE), sd_snwdp = sd(SNOW_DEPTH, na.rm = TRUE)) %>% select(-SNOW_DEPTH) %>% unique()

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hhollandmoritz/NWT_CLM/issues/9#issuecomment-702992551, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5IWJB52GFV72HSC6SH7ILSIZLWBANCNFSM4QL66MVA .

wwieder commented 3 years ago

last question here, but I wonder why soil temperature from FF is totally flatlined? I poked around some with the raw data, and it seems like this may just be a feature of the data? Otherwise all other plots seem to be working well (and clearly illustate the wet bias in surface soils leading to high GPP for the model.

image

hhollandmoritz commented 3 years ago

Fell field temperature readings should now be correct, see https://github.com/hhollandmoritz/NWT_CLM/pull/19#issuecomment-721442484 for more details.