hydroframe / PF_Model_Evaluation

Repo for evaluating parflow simulations and spinup
3 stars 0 forks source link

Upsidedown arrays cause wrong overland flow calculation #9

Closed hoangtv1899 closed 3 years ago

hoangtv1899 commented 3 years ago

Currently, the arrays that are inputs of the calculate_overland_flow_kinematic functions are upside down (as in 00spinup.py). This causes wrong overland flow values as output.

vineetbansal commented 3 years ago

Hi @hoangtv1899 .. are you saying the inputs are upside down and the function is correct? I'm fairly sure the calculations are correct, and I have verified them against the R code. If you have a simple test case that show why they're upside down I can investigate the issue further.

Also, keep in mind that we're no longer using your pfio module, but sticking to the official parflowio module. All code everywhere assumes that .pfb files are stored in the k,j,i format. If your arrays were saved using some other scheme, you would have to implement those tweaks in your script directly. Could this be the issue?

vineetbansal commented 3 years ago

@hoangtv1899 .. see if doing a np.flip on axis 1 (y) in the pfread function gives you the data that you expect (as input to the overland flow algorithm). If this is the case, then the issue likely rests with how the pfb files you are using were generated in the first place. There are ways around this we can implement (allowing a legacy_pfio optional parameter to this function etc. while emitting a warning if this is set) etc.

vineetbansal commented 3 years ago

@hoangtv1899 and I debugged this issue together and concluded that the current overland calculations are correct. Closing this for now.