Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include statistics on 15 day running averages #5

Open
qjhart opened this issue Aug 21, 2015 · 3 comments
Open

Include statistics on 15 day running averages #5

qjhart opened this issue Aug 21, 2015 · 3 comments

Comments

@qjhart
Copy link
Contributor

qjhart commented Aug 21, 2015

At the 2015-08-20 Eto Zones meeting, we discussed that having the maximum of the running 15 day averages was an important component of the ETo Zone. This is because regardless of how the ETo Zones are designed to be used, in practice they are also used for Irrigation scheduling, and as such it is important to understand what the maximum capacity requirements for irrigation should be.

We haven't decided on whether this will be used to define the zones, but we will at the minimum include statistics on the average, min, max, and std dev of this value, as well as the week it occurs.

The way that I will do this is as follows: By the Nyquist theorem, I should be able to capture this signal with weekly samplings of this function. So I will use the following 52 m-d, combinations.

for i in `seq 0 51`; do 
  let d=3+i*7; 
  md=`date --date="2015-01-01 + $d days" +%m-%d`; 
  echo -n "$md "; done

01-04 01-11 01-18 01-25 02-01 02-08 02-15 02-22 03-01 03-08 03-15 03-22 03-29 04-05 04-12 04-19 04-26 05-03 05-10 05-17 05-24 05-31 06-07 06-14 06-21 06-28 07-05 07-12 07-19 07-26 08-02 08-09 08-16 08-23 08-30 09-06 09-13 09-20 09-27 10-04 10-11 10-18 10-25 11-01 11-08 11-15 11-22 11-29 12-06 12-13 12-20 12-27

These will not change for leap years. I will calculate these for all the Saptial CIMIS dates.

For each pixel, and each week, I'll calc

@qjhart
Copy link
Contributor Author

qjhart commented Sep 30, 2015

Edited for 2018 data

for y in `seq 2004 2017`; do 
  for i in 01-04 01-11 01-18 01-25 02-01 02-08 02-15 02-22 03-01 03-08 03-15 03-22 03-29 04-05 04-12 04-19 04-26 05-03 05-10 05-17 05-24 05-31 06-07 06-14 06-
21 06-28 07-05 07-12 07-19 07-26 08-02 08-09 08-16 08-23 08-30 09-06 09-13 09-20 09-27 10-04 10-11 10-18 10-25 11-01 11-08 11-15 11-22 11-29 12-06 12-13 12-20 12-27;
   do if (g.mapset ${y}-${i}); then 
     cg sec=long_term_avg cmd=K_15avg; 
   else 
     echo ${y}-${i} not found; fi ; 
   done; 
done

Last bit of 2018

for y in 2018; do 
  for i in 01-04 01-11 01-18 01-25 02-01 02-08 02-15 02-22 03-01 03-08 03-15 03-22 03-29 04-05 04-12 04-19 04-26 05-03 05-10 05-17 05-24 05-31 06-07 06-14 06-
21 06-28 07-05 07-12 07-19 07-26 08-02 08-09 08-16 08-23 08-30 09-06 09-13 09-20 09-27;
   do if (g.mapset ${y}-${i}); then 
    cg sec=long_term_avg cmd=K_15avg; 
  else 
    echo ${y}-${i} not found; fi ; 
  done; 
done

@qjhart
Copy link
Contributor Author

qjhart commented Sep 30, 2015

One thing that we can do for
And then to back fill the missing data for 2003-10-01 -- 2003-11-25; do

for i in `seq 0 1`; do
m=`date --date="2003-10-01 + $i days" +%Y-%m-%d`;
if [[ ! -d ${m} ]]; then
 g.mapset -c $m;
 ad=$(date --date="2003-01-01 +$(date --date="${m}" +'((%j)/7)*7+3' | bc) days" +xxxx-%m-%d);
 r.mapcalc K_avg="'K_15avg@${ad}'";
 r.mapcalc K=K_avg;
 cg cmd=Rso;
 r.mapcalc G=Gc*K;
 cg cmd=ETo;
 cg cmd=clean-tmp;
fi;
done

@qjhart
Copy link
Contributor Author

qjhart commented Nov 1, 2015

In order to get the water year outputs, we need to create 10 groups;

for y in `seq 2004 2015`; 
do 
rm -rf wy.${y}; mkdir wy.${y}; let p=y-1; 
for m in 10-04 10-11 10-18 10-25 11-01 11-08 11-15 11-22 11-29 12-06 12-13 12-20 12-27; 
do echo ETo_15avg@${p}-${m} >> wy.${y}/REF; 
done; 
for m in 01-04 01-11 01-18 01-25 02-01 02-08 02-15 02-22 03-01 03-08 03-15 03-22 03-29 04-05 04-12 04-19 04-26 05-03 05-10 05-17 05-24 05-31 06-07 06-14 06-21 06-28 07-05 07-12 07-19 07-26 08-02 08-09 08-16 08-23 08-30 09-06 09-13 09-20 09-27;  
do echo ETo_15avg@${y}-${m} >> wy.${y}/REF; 
done; 
done

and then output them.

for y in `seq 2004 2015`; do r.out.gdal input=wy.${y} output=wy.${y}.tif nodata=0; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant