UW-Hydro / RVIC

RVIC Streamflow Routing Model
http://rvic.readthedocs.org
GNU General Public License v3.0
34 stars 58 forks source link

RVIC ignoring fraction #114

Open ghuidobro opened 6 years ago

ghuidobro commented 6 years ago

Hi, my issue is that I ran VIC (image driver, v 5.0.1) and RVIC (v 1.1.1) on my basin, and doing some comparisons I found that my resulting streamflow was greater than the sum of runoff and baseflow, and greater than the total precipitation, all this using the real area of the basin to convert those last ones from mm/day to m3/s. When I changed the basin area to the greater one without considering the fraction of the border cells (an area 1.4 times bigger) I got a streamflow slightly smaller than the precipitation, and exactly the same than the sum of the runoff and the baseflow, which means that this was the area that the model was using. Trying to debug the problem I found that RVIC is reading the fraction from the domain file in the parameter run (the parameters file has the correct area of the basin), and for the convolution run the part of the code that reads the domain is also reading the fraction. After that the code got too complicated to me (I don't know that much of python). I tried to see if the fractions were supposed to be used at some point during the calculations of the convolution itself but I couldn't find it.

Here are my configuration files in case they're useful: rvic.parameters.rlp.txt rvic.convolution.rlp.txt

And the log from the convolution file: RVIC-20180808-040836.log.txt

(Sorry if I didn't explain myself well enough, or if there are spelling mistakes but english isn't my first language)

jhamman commented 6 years ago

Are you using the remap option in RVIC's parameter module?

ghuidobro commented 6 years ago

No I'm not (not really sure what it does), but I've changed it (I've changed everything to see if something works) and the result is the same.

You think that the problem might be in the parameters file? I did find quite more confusing to configure that file, but it seemed to read the fractions and calculate the right area.

On Fri, Aug 24, 2018 at 9:30 PM, Joe Hamman notifications@github.com wrote:

Are you using the remap option in RVIC's parameter module?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/UW-Hydro/RVIC/issues/114#issuecomment-415914907, or mute the thread https://github.com/notifications/unsubscribe-auth/AUWZ3LCbxxcyLj-J1cK5a8RpU0ztVCuVks5uUJqlgaJpZM4VzP2A .

jhamman commented 6 years ago

Hmmm, I'm not sure why your setup isn't working as you would expect. I suggest looking at the diagnostic plots that RVIC generates during the parameters step and evaluating whether those make sense.

ghuidobro commented 6 years ago

Thanks for making me look in the parameters step (I was looking in the convolution before), the plots had in fact some problems and the solution was a very small thing.

In the parameter configuration file I had the option "CONSTRAIN_FRACTIONS: False", because it said "# True when routing to coastal grid cells, else False" and I don't have coastal cells inside my basin (I thought that that's what it meant, maybe my english failed). But I set it to True and now the fraction created during the parameters step is the same as the one in the domain, and the streamflows generated in the convolution step are the right ones.

I thought that I've changed everything to see if something worked, but I must have missed that one.

jhamman commented 6 years ago

Thanks for sticking with this @ghuidobro. I think it generally makes sense to use CONSTRAIN_FRACTIONS=TRUE as a default value. Would you be willing to update the documentation to this effect?

ghuidobro commented 6 years ago

I'm not entirely sure of how to do that. The change must be done here?: https://github.com/UW-Hydro/RVIC/blob/master/docs/user-guide/parameters.md

You want me to delete "Note: True when routing to coastal grid cells, else False."? Or change it to something like "Default: True" I guess that that note must be there for some reason.

jhamman commented 6 years ago

All my use cases have required constraining the fractions and I'm not aware of any specific applications that need the converse. So, yes, your proposed edits seem reasonable. It would be worth checking in the code to make sure there isn't a default=True value somewhere.

ghuidobro commented 6 years ago

Ok, I've never done this so I hope it's ok. I made a pull request, do you have to merge it?

115

And I didn't get the last thing you said, what you wanted to be checked

kwhitney727 commented 2 years ago

@jhamman I have a related question/issue. I am also finding that the domain-wide sum of grid-cell runoff and baseflow volumes (volume computed as flux multiplied by grid-cell area and grid-cell fraction from the domain file) is less than the total streamflow produced at the main outlet (by about 10% in any given year). In my case, I am routing using nested basins and so I cannot use the "constrain_fractions" option (the documentation states that this variable "should be set to True unless routing is being done to nested basins, in which case, this should be set to False."). When I compute the domain-wide sum of runoff and baseflow volume without accounting for the grid-cell fraction (i.e., volume = flux * grid-cell area), the value is roughly equal to the domain-wide streamflow. So I believe the issue is that the source area fractions are not adjusted to account for the domain fraction values of the grid-cells along the edge of the basin (these cells have contributing cell fractions less than 1).

I've compared the diagnostic plots for the various fractions computed in RVIC (domain fractions, aggregated fractions, adjusted fractions, ratio fractions). It does see that "adjusted fractions" are the same as "aggregated fractions", not accounting for the basin boundary cells of fractions less than one (which can be seen in the "domain fractions" plot). Is there a way to adjust the fractions (e.g., set "constrain_fractions" to "True") to account for the domain fractions when using nested basins? I have attached my configuration (file prefix "cfg."), log (file prefix "log.") and diagnostic plot (file suffix ".png") files in case that helps. I appreciate any help you can provide, thank you! cfg.rvic.convolution.txt cfg.rvic.parameters.txt log.rvic.convolution.txt log.rvic.parameters.txt adjusted_fractions_crb uhs_before_subset_crb domain_fractions_crb ratio_fractions_crb sum_uh_before_crb sum_uh_final_crb uhs_after_subset_crb aggregated_fractions_crb