HARPgroup / cbp6

Chesapeake Bay Program Phase 6 Model Suite
0 stars 0 forks source link

Evap & Precip & Flow #199

Open rburghol opened 4 years ago

rburghol commented 4 years ago

How do evap and precip interact to change flow?

hdaniel7 commented 4 years ago

I've created a function to run on the server which reads in all of the climate _1000-2000 files in the model, calculates the mean over the entire timespan, and outputs them in a table containing the segment name, evap mean, and precip mean -- script is found here: https://github.com/HARPgroup/openmi-om/blob/master/R/utils/batch.climate.summarize.R

I've also created a script which calculates the mean precip and temp change from the climate data that Gopal shared with me and compares it with the percent change in Qout (climate change - base / base). Since mean precip and temp change are calculated at land segment scale and Qout is calculated at river segment scale, the script "weights" precip and temp changes to river segment scale by finding all the land-river segments within a river segment, multiplying the precip/temp change of the land-river segment (assumed to be the same as that of the entire land segment) by the fraction of the river segment which the land-river segment comprises, and summing together all of these "weighted" precip/temp changes. Does this sound like the proper method to use when converting metrics between the land-segment and river-segment scale? Script is located here: https://github.com/HARPgroup/cbp6/blob/master/analysis/precip_and_temp_vs_Qout_tables.R

I'm hoping to expand this latter script in the coming days to include the precip/evap climate data in the table -- so the final output will be a table containing:

While I finish up the updates which will produce this gigantic, river-segment scale table of data, two quick questions: does the area-weighting approach I used sound like a logical method of converting data from land-segment to river-segment scale? And, @rburghol, do you know the units of precip and evap used in the inputs to VA Hydro, or what documentation I might read to find these units?

rburghol commented 4 years ago

Daniel -- thanks, this looks like an ambitious, but informative plan. I think your proposed metrics are good, though I think that Runit is a better metric than Qout, since:

  1. You can compare land segs to land segs without the complication of weighting
  2. You won't have the confounding effects of withdrawals, point sources, and reservoirs,
  3. By using Runit, all places big and small will be on the same exact scale
  4. The relationship between evap and precip and flow are all in the same location.

I would also say, store them attached to vahydro model/runid_xx properties for ease of retrieval, sharing and compatibility with existing tools in our toolkit.

As for the units, we went through that a while back and I believe the best source of info was in the lib_hydrology.php and lib_wooomm.cbp.php files in the OM repo. The conversions for cbp runoff elements is in the code there -- I don't recall exact units at the moment, but I know we figured it out last time this came up. Heck, we may even have documented it in a github issue queue issue?

hdaniel7 commented 4 years ago

Thanks for the feedback, Rob -- and I agree that Runit is an ideal unit of comparison when looking at how evapotranspiration and precipitation affect flow, especially as a starting point of analysis without any of the confounding effects you mentioned.

I am a little confused by your terminology, though -- when I think of "Runit" flows, I usually think of the "Runit" values stored within the runlog of the "1. Local Runoff Inflows" object of the river segment (i.e., in this file attached to this object. Since you're suggesting that Runit flows are already at the land segment scale (and the only model data I can find at the land segment scale are the land use tables and the edge-of-stream unit flow files -- the VA Hydro land-river segment model components even seem to exist solely to direct the model to these files), I think that you're suggesting that I compare the sum of these (unit flow per land use)*(land use area) flow values -- summed across the SURO, IFWO, and AGWO distinction as well? Are these land segment scale flow values stored somewhere on VA Hydro?

I remember some confusion about the units for SURO, IFWO, and AGWO awhile back -- and from Vol. 2 of the "Hydrological Simulation Program - FORTRAN (HSPF) : User's Manual" (page 678) we found that they were measured in inches per interval of the data. And, we confirmed this in your lib_wooomm.cbp.php script, where you used

"// converts from watershed in/ivld to watershed ft/ivld (/12.0) // to acre-feet/ivld ( luarea) // to cubic-feet ( 43560 ft-per-acre) // to cfs (/timestep)"

to convert lu_flowvar (the raw value from the eos file (???)) from in/ivld to cfs.

It appears the evaporation and precipitation inputs are both in inches/day -- I found the following in the lib_hydrology.php script:

"$this->prop_desc['et_in'] = 'Evapotrasnpiration Input (inches / day)'; $this->prop_desc['precip_in'] = 'Precipitation (inches / day)';"

-- so thanks for the suggestion to look there!

rburghol commented 4 years ago

Sorry to delay. Thanks for the super deep dive on figuring out the units!

There are 3 ways that I can think of to access what I am referring to as Runit, and to clear it up, Runit is only a term we use in VAHydro/OM.

  1. Like you suggested, you can do the land use * SURO+IFWO+AGWO for each land segment output file. Seems difficult to me -- but of course with option 1 you get the whole bay.
  2. You can use the Land segment outputs in VAHydro. Every land segment in Virginia should have a counterpart in VAHydro, with links to models, just like the river segments, facilities, etc. Their model outputs are weighted to the land use for 2013, so all that math is done in VAHYdro. The minus forthis is that it is only VA -- but that is actually what I had in my mind.
  3. Choose 3 representative land uses, forest, row crops and pervious urban, and just sum the SURO+IFWO+AGWO for these single landuses, and do your analysis on the range of cover types. This is one that we discussed briefly a good while back, and I think it has a great appeal, since it looks into forest versus other impervious types -- a question that I think is highly compelling since many are advocating for reforestation as a climate mitigation strategy, and still others are saying increasing forest will exacerbate warming!

Food for thought...

hdaniel7 commented 4 years ago

Some updates:

  1. While doing a bit of analysis on the temp/prcp/evap/flow changes, I ran into some odd trends -- Dr. Scott suggested that I check a few segments manually to ensure that there are no issues in my script. These QA checks for two river segments follow -- and I'm happy to report that I found no issues in the calculation process. Rseg_Calculation_Check.pdf

  2. While there were no issues in the calculations, I did run into some issues with the timespans of the metrics -- namely, using the VA Hydro Qout variable was improper, since this Qout represents the mean of the entire scenario timespan (1984-2015 for base, 1991-2000 for CC). I think it would be interesting to keep this Qout value for comparison as well as the Runit -- however I'll have to calculate it by downloading VA Hydro data, trimming it to 1991-2000 and calculating the mean, so keeping Qout will add quite a bit of computation time to the scripts. Similarly, the prcp/evap means that I had calculated were over the full timescale, so I'll update that script so everything is compared over the same timescale as well (which is why I haven't posted any of the results in this post)

  3. Pertaining to Runit -- I've been trying to find the land segment features you're talking about on VA Hydro but haven't yet had any luck -- for example, when I search for 'N51101', the only features I can find are the land-river segment containing the links to the edge-of-stream unit flow files. Could you show me an example of one of these land segment features so I can better understand how to find them?

  4. Also Runit related -- I agree that delving into the flows from a few specific land uses will be fascinating as this analysis progresses. I'll probably start this Runit comparison by doing the full (land use area)*(land use unit flow) summed calculation -- either way I'll have to load those giant edge-of-stream flow files into R for each river segment, which was something that I was hoping to avoid having to do -- adds a lot of computation time.

Once I make some of these changes (especially fixing the timescales), I'll post some of the results -- hopefully tomorrow or Tues.

hdaniel7 commented 4 years ago

While I haven't yet updated the Qout timespans or added Runit functionality, I'll share a few plots that are causing me a bit of concern.

The following three plots show river segment percent change in precipitation (from Gopal, in the "lseg_delta_pr_RCP45_Ensemble_CRT_2041_2070_P10", "lseg_delta_pr_RCP45_Ensemble_CRT_2041_2070_P50", and "lseg_delta_pr_RCP45_Ensemble_CRT_2041_2070_P90" files) plotted against the river segment scale percent change in precipitation that is actually expressed in the scenario (this was obtained by mining the precipitation data stored here -- the mean of the prcp and evap values over the timespan were taken for each of the scenarios and the percent change was calculated based on this).

Ideally, of course, we'd like to see a roughly one-to-one increase across the plots, with percents approximately equal to each other... instead, we see the following:

P10 Precip (Gopal Data) vs. P10 Precip (Input Climate Data): precip_p10

P50 Precip (Gopal Data) vs. P50 Precip (Input Climate Data): precip_p50

P90 Precip (Gopal Data) vs. P90 Precip (Input Climate Data): precip_p90

I'll keep working on adding functionality for Runit and for Qout with the proper timescale -- however, these plots have me a bit worried that the climate scenarios are not representing the climate data nearly as well as we would like.

rburghol commented 4 years ago

Daniel -- are you using the precip data in vahydro models at the moment, or are you using what you harvested from the WDMs? I am pretty sure that you ARE (I mean, you said you mined it from the WDMs), I just wanted to double check and not assume -- note: using the VAhydro model as it currently is, many of those segments don't have the precip inputted, we load precip & evap for large impoundments as they are the only ones that make an appreciable impact.

So -- let's assume that you are comparing Gopals summaries to the WDM data you are harvesting. If so:

  1. can there be an issue with the unit conversion? Or would you think if that was the case you would see a nice tight line, but just with a slope that differed from 1:1
  2. You are saying river seg, are these actually river seg, or are they land seg? You list the names such as "lseg_deltapr..." which makes me think it is land seg (lseg).
  3. Are you certain that "lseg_delta_pr_RCP45_Ensemble_CRT_2041_2070_P10" is the same scenario as "5545HS10CA2_and_55R45KK1095"?
  4. How are you calculating the % change? Daily, or period mean? 1990-2000 only right?
  5. Landsegs -- sorry, these are land river segs, I misspoke - sorry to mislead you. These segments DO contain the flows for a single land-seg, but as mentioned above, they are troubling because they already weight to area of the different land uses. But, they DO represent the precip + Evap of a single land segment. I think that the single land use, or small group of land uses might be preferable.
  6. Per your above investigation for Flow, Qout, yeah, I only use the l30_cc_Qout and l90_cc_Qout when checking these, running a batch VAHydro output summary routine to simply add "cc_Qout" would not be terribly difficult, and would probably run in an hour or 2, but we'd have to have a good reason to do so. I still think that evap and Runoff, especially for short episodes (les than 90 days) is a more interesting metric to explore, as mean flow is pretty insensitive. But this is doable if you have a strong need.

--

hdaniel7 commented 4 years ago

Rob, I'm using the WDM harvested precipitation -- I'm not pulling any precipitation data from VA Hydro. Other responses:

  1. I suppose there could be some sort of unit conversion issue -- however, since I'm comparing two percents, I don't believe that this is the case. This was one of the primary things I was checking for when I did a few calculations by hand to check.
  2. I'm converting the LSeg data to RSeg scale so that the flows can also be compared on the RSeg scale -- so although Gopal's summary data is in LSeg scale, the values are area-weighted by the fraction of the RSeg that each LRSeg takes up. Although the vast majority of this data is in LSeg scale, I figured it made more sense conceptually to scale it to the RSeg -- as opposed to weighting RSeg flows to LSeg scale, which doesn't seem like a good idea.
  3. I hadn't considered that the scenarios could be different -- I know, for example, that the "5545HS10CA2_and_55R45KK1095" directory contains the climate data that we reference for the CC 10/10 scenario (CBASE1808L55CY55R45P10R45P10Y), and I know that the scenario CBASE1808L55CY55R45P10R45P10Y is meant to show the P10 precip/temp for RCP 4.5 at the 2040-2070 timescale -- which is what the "lseg_delta_pr_RCP45_Ensemble_CRT_2041_2070_P10" file is meant to list the precipitation changes for.
  4. I'm calculating the % changes by: (1) trimming CC and base data to Jan. 1 1991 - Dec. 31 2000 timescale (2) calculating mean precip value for CC and base data over this timespan (3) calculating percent difference [CC - base] / base. So, in short period mean, 1991-2000.
  5. I see what you're talking about -- example LRSeg flow file here. Are you suggesting that all of the columns (aop_suro, aop_ifwo, aop_agwo, ..., wto_agwo) are already multiplied by their land use areas (no longer "unit flows")? There are 3 columns near the end called suro, ifwo, and agwo -- might not summing these three columns, finding the average over the 1991-2000 timespan, and comparing this value between base and CC scenario be a valid way of finding "% change in runoff", even if it is landuse-weighted?
  6. I agree that runoff is a better comparison than Qout -- so I'll keep in mind that a cc_Qout metric could be added in the future, but I don't think we need to implement it for now.
rburghol commented 4 years ago

I'm using the WDM harvested precipitation Most excellent.