Skip to content

Commit

Permalink
Updated documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
qjhart committed Apr 6, 2016
2 parents 0d5b775 + 9a2c6b8 commit 4c58ddd
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 68 deletions.
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,51 @@
# ssj-calsimetaw
Application of CalSIMETAW model to the SSJ region
Application of the CalSIMETAW / CUPS inspired calculation of
ET, using Kc tables and ETo.

## This will show what we plan to do.
Lead: Quinn Hart, Morteza Orang, Tariq Kadir

This method provides estimations of ET based on DWR's published Kc (Crop coefficient) curves for the various crops grown within the Bay Delta Service Area. CalSIMETAW is a more complete water balance model. In effort we are only including the ET calculation portion. This includes soil evaporation and plant evapotranspiration.

Extensive information, including model formulation can be found in the [Cups Users' Guide].

## [Results](./results)

We will investigate a number of different methods for calculating ET, differing primarily in the landcover model used, but also in the workflow for calculation of the model. Regardless of the method however, the outputs and intermediate products will be the same.

This method will provide daily estimates of ET and Kc based on Spatial CIMIS ETo, CalSIMETAW ppt and the Kc curves supplied by DWR.

ETo and Precipitation (ppt) are taken directly from the [Weather Repository]

### NASA Landcover Based

NASA has provided the SSJ team with a vector data layer of landcover that includes [Cropland Data Layer] (CDL) crop types. We will use this vector map to calculate ET. For this effort, we will use vector processing of for the calculation. We will also use the larger CalSIMETAW 4km grid for weather inputs.

Data | Daily | Monthly
--- | --- | ---
ET | [results/nasa/daily] | [results/nasa/monthly]
Kc | [results/nasa/daily] | [results/nasa/monthly]

To create the summarization tables, the vector maps were intersected with the [Island Regions].

To create the required 30m raster map, the resultant outputs where rasterized and exported.

[NASA Landcover]: https://github.com/ssj-delta-cu/ssj-nasa-landcover
[results/nasa/daily]: ./results/nasa/daily
[results/nasa/monthly]: ./results/nasa/monthly

### CDL Landcover Based

The USDA [Cropland Data Layer] is a 30m raster based crop data type. Unlike the NASA product, the methodology does not try to make uniform fields, but estimates each pixel seperately. The data is provided in a raster form. For this method, we utilized Google's Earth Engine Platform, as a test of it's utility.

Data | Daily | Monthly
--- | --- | ---
ET | [results/cdl/daily] | [results/cdl/monthly]
Kc | [results/cdl/daily] | [results/cdl/monthly]

[results/cdl/daily]: ./results/cdl/daily
[results/cdl/monthly]: ./results/cdl/monthly

[Cropland Data Layer]: http://www.nass.usda.gov/Research_and_Science/Cropland/SARS1a.php

[CUPS Users' Guide]: ./documentation/cups.pdf
[Weather Repository]: https://github.com/ssj-delta-cu/ssj-weather/cimis
4 changes: 0 additions & 4 deletions SUMMARY.md

This file was deleted.

Binary file added documentation/cups.pdf
Binary file not shown.
67 changes: 67 additions & 0 deletions js/cdl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
var CDL={
to_dwr:[
{
0:0, 1:5, 2:3, 3:2, 4:8, 5:8, 6:8,
10:8, 11:8, 12:5, 13:5, 14:16,
21:1, 22:1, 23:1, 24:1, 25:1, 26:1, 27:1, 28:1, 29:1,
30:1, 31:8, 32:8, 33:7, 34:0, 35:16, 36:9, 37:1, 38:0, 39:1,
41:4, 42:6, 43:15, 44:16, 45:0, 46:15,47:16,48:13,49:14,
50:13, 51:0, 52:6, 53:16, 54:11, 55:16, 56:0, 57:16, 58:10, 59:10,
60:10, 61:10, 63:23, 64:23, 65:23, 66:18, 67:18, 68:18, 69:20,
70:0, 71:18, 72:19, 74:18, 75:17, 76:17, 77:18,
81:0, 82:21, 83:24, 87:22, 88:0,
92:0,
111:24, 112:0,
121:21, 122:21, 123:21, 124:21,
131:23,
141:23, 142:23, 143:23,
152:23,
176:10,
190:23,
195:22,
204:17, 205:1, 206:16, 207:16, 208:14, 209:13,
210:18, 211:19, 212:19, 213:13, 214:16, 216:16, 217:18, 218:18, 219:16,
220:18, 221:16, 222:13, 223:18, 224:10, 225:1, 226:1, 227:16, 229:13,
230:16, 231:16, 232:16, 233:16, 234:1, 235:1, 236:1, 237:1, 238:1, 239:8,
240:8, 241:3, 242:16, 243:16, 244:16, 245:16, 246:16, 247:16, 248:16, 249:13,
250:16, 254:1
},
// 2nd Crop
{
0:0, 1:99, 2:99, 3:99, 4:99, 5:99, 6:99,
10:99, 11:99, 12:99, 13:99, 14:99,
21:99, 22:99, 23:99, 24:99, 25:99, 26:8, 27:99, 28:99, 29:99,
30:99, 31:99, 32:99, 33:99, 34:0, 35:99, 36:99, 37:99, 38:0, 39:99,
41:99, 42:99, 43:99, 44:99, 45:0, 46:99, 47:99, 48:99, 49:99,
50:99, 51:0, 52:99, 53:99, 54:99, 55:99, 56:0, 57:99, 58:99, 59:99,
60:99, 61:99, 63:99, 64:99, 65:99, 66:99, 67:99, 68:99, 69:99,
70:0, 71:99, 72:99, 74:99, 75:99, 76:99, 77:99,
81:99, 82:99, 83:99, 87:99, 88:0,
92:0,
111:99, 112:0,
121:99, 122:99, 123:99, 124:99,
131:99,
141:99, 142:99, 143:99,
152:99,
176:99,
190:99, 195:99,
204:99, 205:99, 206:99, 207:99, 208:99, 209:99,
210:99, 211:99, 212:99, 213:99, 214:99, 216:99, 217:99, 218:99, 219:99,
220:99, 221:99, 222:99, 223:99, 224:99, 225:3, 226:3, 227:16, 229:13,
230:1, 231:13, 232:3, 233:1, 234:8, 235:8, 236:8, 237:5, 238:3, 239:3,
240:1, 241:8, 242:16, 243:16, 244:16, 245:16, 246:16, 247:16, 248:16, 249:13,
250:16, 254:8
}],
exp:function(band,num) {
var key;
var exp='';
var dwr=this.to_dwr[num];
for (key in dwr) {
exp+="("+band+"=="+key+")?"+dwr[key]+":";
}
exp+="0";
return exp;
}
};

console.log(CDL.to_dwr_exp('cdl',0));
86 changes: 24 additions & 62 deletions js/cups.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,75 +134,37 @@ var crop_def = function(number) {
};

var crop_schedule = function(number,plant,harvest) {
var A,B,C,D,E;
var year,diff,days;
var A,B,C,D,E;
var year,diff,days;

var crop = crop_def(number);
var crop = crop_def(number);

if (typeof plant === 'object' ) {
if (typeof harvest === 'object') {
A = plant;
E = harvest;
diff = E-A;
} else {
year=plant.getFullYear(); // First get length of default harvest
A = new Date(year,crop.plant[0]-1,crop.plant[1]);
E = new Date((crop.plant[0]<crop.harvest[0])?year:year+1,crop.harvest[0]-1,crop.harvest[1]);
var diff = E-A;
// Now get moved days
A = plant;
E = new Date(A.getTime()+diff);
if (typeof plant === 'object' ) { if (typeof harvest === 'object') { A = plant; E = harvest; diff = E-A; } else { year=plant.getFullYear(); // First get length of default harvest A = new Date(year,crop.plant[0]-1,crop.plant[1]); E = new Date((crop.plant[0]<crop.harvest[0])?year:year+1,crop.harvest[0]-1,crop.harvest[1]); var diff = E-A; // Now get moved days A = plant; E = new Date(A.getTime()+diff); }
} else { if (typeof plant === 'number') { year=plant; } else { year = new Date(Date.now()).getFullYear(); } A = new Date(year,crop.plant[0]-1,crop.plant[1]); E = new Date((crop.plant[0]<crop.harvest[0])?year:year+1,crop.harvest[0]-1,crop.harvest[1]); diff = E-A;
}
} else {
if (typeof plant === 'number') {
year=plant;
} else {
year = new Date(Date.now()).getFullYear();
}
A = new Date(year,crop.plant[0]-1,crop.plant[1]);
E = new Date((crop.plant[0]<crop.harvest[0])?year:year+1,crop.harvest[0]-1,crop.harvest[1]);
diff = E-A;
}
var days = Math.round(diff/1000/60/60/24);
var B = new Date(A.getTime()+diff*crop.BCDp[0]/100);
var C = new Date(A.getTime()+diff*crop.BCDp[1]/100);
var D = new Date(A.getTime()+diff*crop.BCDp[2]/100);
return {
number:number,
name:crop.name,
BCDp:crop.BCDp,
Kc:crop.Kc,
A:A,
B:B,
C:C,
D:D,
E:E,
days:days
};
var days = Math.round(diff/1000/60/60/24);
var B = new Date(A.getTime()+diff*crop.BCDp[0]/100);
var C = new Date(A.getTime()+diff*crop.BCDp[1]/100);
var D = new Date(A.getTime()+diff*crop.BCDp[2]/100);
return { number:number, name:crop.name, BCDp:crop.BCDp, Kc:crop.Kc, A:A, B:B, C:C, D:D, E:E, days:days
};
};

var Kc = function(c,d) {
d = (typeof d !== 'undefined') ? d : new Date(Date.now());
if (typeof c !== 'object') {
c = crop_schedule(sched,d.getFullYear());
}
if (d < c.A) {
return undef;
} else if (d < c.B) {
return c.Kc[0];
} else if (d < c.C) {
return c.Kc[0] + (c.Kc[1]-c.Kc[0])*(d-c.B)/(c.C-c.B);
} else if (d < c.D) {
return c.Kc[1];
} else if (d < c.E) {
return c.Kc[1] + (c.Kc[2]-c.Kc[1])*(d-c.B)/(c.C-c.B);
} else {
return undef;
}
d = (typeof d !== 'undefined') ? d : new Date(Date.now());
if (typeof c !== 'object') { c = crop_schedule(sched,d.getFullYear());
}
if (d < c.A) { return undef;
} else if (d < c.B) { return c.Kc[0];
} else if (d < c.C) { return c.Kc[0] + (c.Kc[1]-c.Kc[0])*(d-c.B)/(c.C-c.B);
} else if (d < c.D) { return c.Kc[1];
} else if (d < c.E) { return c.Kc[1] + (c.Kc[2]-c.Kc[1])*(d-c.B)/(c.C-c.B);
} else { return undef;
}
};

module.exports = {
crop_def:crop_def,
crop_schedule:crop_schedule,
Kc:Kc
crop_def:crop_def,
crop_schedule:crop_schedule,
Kc:Kc
}
1 change: 1 addition & 0 deletions results/cdl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# CDL results
1 change: 1 addition & 0 deletions results/nasa/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# NASA Landcover Results

0 comments on commit 4c58ddd

Please sign in to comment.