Skip to content

Commit

Permalink
Added an example to create all the weather data required for landsat …
Browse files Browse the repository at this point in the history
…overpasses.
  • Loading branch information
qjhart committed Jul 9, 2016
1 parent f2413a3 commit 15bd719
Show file tree
Hide file tree
Showing 12 changed files with 1,372 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*~
## Not sure where these came from
examples/landsat_inputs/raster.csv
examples/landsat_inputs/raster.js
62 changes: 62 additions & 0 deletions examples/landsat_inputs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#! /usr/bin/make -f
SHELL:=/bin/bash

station_url:=http://et.water.ca.gov/api/station

wy2015.dates:=2014-10-12 2014-10-28 2014-12-31 \
2015-03-05 2015-03-21 2015-04-22 2015-05-08 2015-05-24 \
2015-06-25 2015-07-11 2015-07-27 2015-08-12 2015-09-29

wy2014.dates:=2014-09-10

base:=../..
wy2015.hsdir:=${base}/hourly_station/2015.wy
wy2014.hsdir:=${base}/hourly_station/2014.wy_partial
wy2014.dsdir:=${base}/daily_station/2014.wy_partial
wy2015.dsdir:=${base}/daily_station/2015.wy
wy2014.csdir:=${base}/cimis/2014.wy_partial
wy2015.csdir:=${base}/cimis/2015.wy
stations:=$(shell cd ${wy2015.hsdir}; ls *.csv | sed -e 's/\.csv//')
hour:=1[012]00

INFO::
@echo stations:=${stations}
@echo wy2014.dates:=${wy2014.dates}
@echo wy2015.dates:=${wy2015.dates}

all: overpass.csv station.csv wy2014_daily.csv wy2015_daily.csv wy2014_hourly.csv wy2015_hourly.csv wy2014_cimis.csv wy2015_cimis.csv

overpass.csv:
for d in ${wy2014.dates} ${wy2015.dates}; do \
pdt=`TZ='America/Los_Angeles' date --date="$$d 18:45 GMT" +%H:%M`; \
echo $$d,$$pdt; \
done > $@

station.csv:
echo station,name,elevation,hms_lon,longitude,hms_lat,latitude > $@
curl ${station_url} | jq -r '.Stations[] | [.StationNbr,.Name,.Elevation,.HmsLongitude,.HmsLatitude] | @csv' | sed -e 's| / |","|g' >> $@

wy2014_daily.csv wy2015_daily.csv:%_daily.csv:
echo 'Station,Date,DayAirTmpMinValue,DayAirTmpMaxValue,DayAirTmpAvgValue,DayDewPntValue,DayEtoValue,DayAsceEtoValue,DayPrecipValue,DaySolRadAvgValue,DaySolRadNetValue,DayWindSpdAvgValue,DayVapPresMaxValue,DayVapPresMinValue,DayAirTmpMinQc,DayAirTmpMaxQc,DayAirTmpAvgQc,DayDewPntQc,DayEtoQc,DayAsceEtoQc,DayPrecipQc,DaySolRadAvgQc,DaySolRadNetQc,DayWindSpdAvgQc,DayVapPresMaxQc,DayVapPresMinQc' > $@;
@for s in ${stations}; do \
for d in ${$*.dates}; do \
grep $$d < ${$*.dsdir}/$$s.csv; \
done; \
done >> $@;

wy2014_hourly.csv wy2015_hourly.csv:%_hourly.csv:
echo 'Station,Date,Hour,HlyAirTmpValue,HlyDewPntValue,HlyEtoValue,HlyNetRadValue,HlyAsceEtoValue,HlyPrecipValue,HlyRelHumValue,HlyResWindValue,HlySoilTmpValue,HlySolRadValue,HlyVapPresValue,HlyWindDirValue,HlyWindSpdValue,HlyAirTmpQc,HlyDewPntQc,HlyEtoQc,HlyNetRadQc,HlyAsceEtoQc,HlyPrecipQc,HlyRelHumQc,HlyResWindQc,HlySoilTmpQc,HlySolRadQc,HlyVapPresQc,HlyWindDirQc,HlyWindSpdQc' > $@;
@for s in ${stations}; do \
for d in ${$*.dates}; do \
grep $$d < ${$*.hsdir}/$$s.csv | grep ',"${hour}",'; \
done; \
done >> $@;

wy2014_cimis.csv wy2015_cimis.csv:%_cimis.csv:
echo 'x,y,z,station_id,date,day_air_tmp_min,day_air_tmp_min_qc,day_air_tmp_max,day_air_tmp_max_qc,day_wind_spd_avg,day_wind_spd_avg_qc,day_rel_hum_max,day_rel_hum_max_qc,day_dew_pnt,day_dew_pnt_qc' > $@;
@for s in ${stations}; do \
for d in ${$*.dates}; do \
grep $$d < ${$*.dsdir}/$$s.csv; \
done; \
done >> $@;

26 changes: 26 additions & 0 deletions examples/landsat_inputs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Landsat overpass example

This gives a quick example of using this data. In particular, for a
number of Landsat overpasses, this extracts pretty much everything
you'd need to calculate ET for those dates at a set of stations.

Take a look at the Makefile for some simple example processing, or try:

```{bash}
make INFO # Shows the dates
make all
```

The files created are:

* ```overpass.csv``` Gives the local PDT time for these overpasses

* ```station.csv``` extracts all the cimis stations, and their elevation

* ```wy201?_daily.csv``` Daily station data for the CIMIS stations.

* ```wy201?_hourly.csv``` Hourly station data for the CIMIS stations.

* ```wy201?_cimis.csv``` Hourly station data for the CIMIS stations.


14 changes: 14 additions & 0 deletions examples/landsat_inputs/overpass.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
2014-09-10,11:45
2014-10-12,11:45
2014-10-28,11:45
2014-12-31,10:45
2015-03-05,10:45
2015-03-21,11:45
2015-04-22,11:45
2015-05-08,11:45
2015-05-24,11:45
2015-06-25,11:45
2015-07-11,11:45
2015-07-27,11:45
2015-08-12,11:45
2015-09-29,11:45
Binary file added examples/landsat_inputs/ssj.zip
Binary file not shown.
250 changes: 250 additions & 0 deletions examples/landsat_inputs/station.csv

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions examples/landsat_inputs/wy2014_cimis.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
x,y,z,station_id,date,day_air_tmp_min,day_air_tmp_min_qc,day_air_tmp_max,day_air_tmp_max_qc,day_wind_spd_avg,day_wind_spd_avg_qc,day_rel_hum_max,day_rel_hum_max_qc,day_dew_pnt,day_dew_pnt_qc
"47","2014-09-10","11.9","35.3","23.3","9.4","5.21","5.35","0","255","122","1.6","1.7","0.8"," "," "," "," "," "," "," "," "," "," "," "," "
"155","2014-09-10","14.2","34.8","24","10.7",,,"0","232",,"0.5","1.6","0.9"," "," "," "," ","N","N"," "," ","N"," "," "," "
"170","2014-09-10","10.6","35.7","22.6","8.8","5.06","5.1","0.1","266","127","1.1","1.6","0.5"," "," "," "," "," "," "," "," "," "," "," "," "
"6","2014-09-10","17.9","36.5","28.7","8","5.29","5.58","0","352","122","1.9","1.5","0.7","Y"," ","Y","Y"," "," "," ","R","R"," "," "," "
"121","2014-09-10","10","35.3","21.5","10.7","4.98","5.16","0","266","125","1.4","1.9","0.7"," "," "," "," "," "," "," "," "," "," "," "," "
"196","2014-09-10",,"38","30","5.5","5.4","5.23","0","258","121","1","1.9",,"S"," "," "," "," "," "," "," "," "," "," ","S"
"131","2014-09-10","12.8","36","23.9","9.8","4.69","4.63","0","244","117","0.8","1.7","0.9"," "," "," "," "," "," "," "," "," "," "," "," "
"212","2014-09-10","11.5","36.8","23","10.2","4.63","4.74","0","231","113","1.7","1.6","0.8"," "," "," "," "," "," "," "," "," "," "," "," "
"166","2014-09-10","9.2","36","21.6","11.7","4.77",,"0","270","128","1","2.2","1"," "," "," "," "," ","N"," "," "," "," "," "," "
"70","2014-09-10","10","33.9","22","12.7","4.81","4.86","0","264","129","1.1","2","0.9"," "," "," "," "," "," "," "," "," "," "," "," "
"71","2014-09-10","10.8","33.4","21.3","11.9","4.81","4.84","0.1","258","128","1.3","2","1"," "," "," "," "," "," "," "," "," "," "," "," "
"191","2014-09-10","11","36.9","23.1","8.9","5.36","5.34","0","248","129","1.4","1.4","0.6"," "," "," "," "," "," "," "," "," "," "," "," "
"167","2014-09-10","12.1","35","23.7","8.3","5.2","5.22","0","250","120","1.4","1.6","0.7"," "," "," "," "," "," "," "," "," "," "," "," "
"140","2014-09-10","12.1","34.7","22.5","11.2","5","5.22","0","268","126","1.6","2.2","0.8"," "," "," "," "," "," "," "," "," "," "," "," "
"139","2014-09-10",,"33.8","28.2","7.4",,,"0","320",,"1.3","1.6",,"S"," ","Y","Y","N","N"," ","R","N"," "," ","S"
16 changes: 16 additions & 0 deletions examples/landsat_inputs/wy2014_daily.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Station,Date,DayAirTmpMinValue,DayAirTmpMaxValue,DayAirTmpAvgValue,DayDewPntValue,DayEtoValue,DayAsceEtoValue,DayPrecipValue,DaySolRadAvgValue,DaySolRadNetValue,DayWindSpdAvgValue,DayVapPresMaxValue,DayVapPresMinValue,DayAirTmpMinQc,DayAirTmpMaxQc,DayAirTmpAvgQc,DayDewPntQc,DayEtoQc,DayAsceEtoQc,DayPrecipQc,DaySolRadAvgQc,DaySolRadNetQc,DayWindSpdAvgQc,DayVapPresMaxQc,DayVapPresMinQc
"47","2014-09-10","11.9","35.3","23.3","9.4","5.21","5.35","0","255","122","1.6","1.7","0.8"," "," "," "," "," "," "," "," "," "," "," "," "
"155","2014-09-10","14.2","34.8","24","10.7",,,"0","232",,"0.5","1.6","0.9"," "," "," "," ","N","N"," "," ","N"," "," "," "
"170","2014-09-10","10.6","35.7","22.6","8.8","5.06","5.1","0.1","266","127","1.1","1.6","0.5"," "," "," "," "," "," "," "," "," "," "," "," "
"6","2014-09-10","17.9","36.5","28.7","8","5.29","5.58","0","352","122","1.9","1.5","0.7","Y"," ","Y","Y"," "," "," ","R","R"," "," "," "
"121","2014-09-10","10","35.3","21.5","10.7","4.98","5.16","0","266","125","1.4","1.9","0.7"," "," "," "," "," "," "," "," "," "," "," "," "
"196","2014-09-10",,"38","30","5.5","5.4","5.23","0","258","121","1","1.9",,"S"," "," "," "," "," "," "," "," "," "," ","S"
"131","2014-09-10","12.8","36","23.9","9.8","4.69","4.63","0","244","117","0.8","1.7","0.9"," "," "," "," "," "," "," "," "," "," "," "," "
"212","2014-09-10","11.5","36.8","23","10.2","4.63","4.74","0","231","113","1.7","1.6","0.8"," "," "," "," "," "," "," "," "," "," "," "," "
"166","2014-09-10","9.2","36","21.6","11.7","4.77",,"0","270","128","1","2.2","1"," "," "," "," "," ","N"," "," "," "," "," "," "
"70","2014-09-10","10","33.9","22","12.7","4.81","4.86","0","264","129","1.1","2","0.9"," "," "," "," "," "," "," "," "," "," "," "," "
"71","2014-09-10","10.8","33.4","21.3","11.9","4.81","4.84","0.1","258","128","1.3","2","1"," "," "," "," "," "," "," "," "," "," "," "," "
"191","2014-09-10","11","36.9","23.1","8.9","5.36","5.34","0","248","129","1.4","1.4","0.6"," "," "," "," "," "," "," "," "," "," "," "," "
"167","2014-09-10","12.1","35","23.7","8.3","5.2","5.22","0","250","120","1.4","1.6","0.7"," "," "," "," "," "," "," "," "," "," "," "," "
"140","2014-09-10","12.1","34.7","22.5","11.2","5","5.22","0","268","126","1.6","2.2","0.8"," "," "," "," "," "," "," "," "," "," "," "," "
"139","2014-09-10",,"33.8","28.2","7.4",,,"0","320",,"1.3","1.6",,"S"," ","Y","Y","N","N"," ","R","N"," "," ","S"
46 changes: 46 additions & 0 deletions examples/landsat_inputs/wy2014_hourly.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Station,Date,Hour,HlyAirTmpValue,HlyDewPntValue,HlyEtoValue,HlyNetRadValue,HlyAsceEtoValue,HlyPrecipValue,HlyRelHumValue,HlyResWindValue,HlySoilTmpValue,HlySolRadValue,HlyVapPresValue,HlyWindDirValue,HlyWindSpdValue,HlyAirTmpQc,HlyDewPntQc,HlyEtoQc,HlyNetRadQc,HlyAsceEtoQc,HlyPrecipQc,HlyRelHumQc,HlyResWindQc,HlySoilTmpQc,HlySolRadQc,HlyVapPresQc,HlyWindDirQc,HlyWindSpdQc
"47","2014-09-10","1000","24.3","13.2","0.45","365","0.44","0","50","1.4","19.7","624","1.5","297","1.8"," "," "," "," "," "," "," "," "," "," "," "," "," "
"47","2014-09-10","1100","27.3","13.1","0.57","444","0.56","0","42","1.6","20","739","1.5","332","2"," "," "," "," "," "," "," "," "," "," "," "," "," "
"47","2014-09-10","1200","29.6","11.6","0.66","486","0.65","0","33","1.9","20.4","801","1.4","351","2.3"," "," "," "," "," "," "," "," "," "," "," "," "," "
"155","2014-09-10","1000","24.6","11.8",,,,"0","45","0.3","25.7","605","1.4","299","0.6"," "," ","N","N","N"," "," "," "," "," "," "," "," "
"155","2014-09-10","1100","27.5","11.5",,,,"0","37","0.5","27.1","721","1.4","307","0.6"," "," ","N","N","N"," "," "," "," "," "," "," "," "
"155","2014-09-10","1200","29.7","8.5",,,,"0","27","0.6","28","788","1.1","298","0.8"," "," ","N","N","N"," "," "," "," "," "," "," "," "
"170","2014-09-10","1000","23.3","12.8","0.43","377","0.43","0","52","0.8","18.5","650","1.5","309","1.1"," "," "," "," "," "," "," "," "," "," "," "," "," "
"170","2014-09-10","1100","27.5","11.6","0.57","456","0.57","0","37","0.5","18.5","775","1.4","292","1.3"," "," "," "," "," "," "," "," "," "," "," "," "," "
"170","2014-09-10","1200","30.8","9.4","0.65","480","0.67","0","27","0.7","18.5","845","1.2","116","1.6"," "," "," "," "," "," "," "," "," "," "," "," "," "
"6","2014-09-10","1000","27.5","10.4","0.49","385","0.52","0","35","1","21.4","710","1.3","334","1.3"," "," "," "," "," "," "," "," "," "," "," "," "," "
"6","2014-09-10","1100","28.8","7.9","0.62","433","0.65","0","27","2.6","21.4","784","1.1","8","2.8"," "," "," "," "," "," "," "," "," "," "," "," "," "
"6","2014-09-10","1200","30.5","6.9","0.67","470","0.7","0","23","2","21.5","838","1","352","2.5"," "," "," "," "," "," "," "," "," "," "," "," "," "
"121","2014-09-10","1000","26","11.8","0.47","377","0.47","0","41","1","21.4","657","1.4","9","1.2"," "," "," "," "," "," "," "," "," "," "," "," "," "
"121","2014-09-10","1100","28.8","9.6","0.6","450","0.6","0","30","1.6","21.4","765","1.2","352","1.9"," "," "," "," "," "," "," "," "," "," "," "," "," "
"121","2014-09-10","1200","30.2","8.3","0.65","474","0.67","0","25","1.5","21.4","840","1.1","0","1.9"," "," "," "," "," "," "," "," "," "," "," "," "," "
"196","2014-09-10","1000","29.3","6.6","0.48","349","0.48","0","24","0.9","22.9","613","1","16","1.3"," "," "," "," "," "," "," "," "," "," "," "," "," "
"196","2014-09-10","1100","30.9","6.5","0.59","424","0.59","0","22","1.3","22.8","720","1","335","1.6"," "," "," "," "," "," "," "," "," "," "," "," "," "
"196","2014-09-10","1200","32.8","5","0.69","472","0.69","0","17","1.8","22.8","795","0.9","15","2.2"," "," "," "," "," "," "," "," "," "," "," "," "," "
"131","2014-09-10","1000","26.1","12.8","0.43","351","0.43","0","44","0.7","23.1","602","1.5","260","1.2"," "," "," "," "," "," "," "," "," "," "," "," "," "
"131","2014-09-10","1100","28.3","12","0.54","426","0.54","0","36","0.8","23.3","711","1.4","277","1.3"," "," "," "," "," "," "," "," "," "," "," "," "," "
"131","2014-09-10","1200","30.1","9.8","0.62","462","0.61","0","28","1.1","23.7","766","1.2","282","1.7"," "," "," "," "," "," "," "," "," "," "," "," "," "
"212","2014-09-10","1000","26.3","12.2","0.41","320","0.42","0","41","1.3","18.7","553","1.4","1","1.3"," "," "," "," "," "," "," "," "," "," "," "," "," "
"212","2014-09-10","1100","29.3","9.9","0.53","399","0.53","0","30","1.3","18.7","671","1.2","11","1.3"," "," "," "," "," "," "," "," "," "," "," "," "," "
"212","2014-09-10","1200","31.3","9.2","0.61","449","0.61","0","25","1.6","18.8","744","1.2","13","1.6"," "," "," "," "," "," "," ","R"," "," "," "," "," "
"166","2014-09-10","1000","23.3","14.5","0.45","386",,"0","58","0.7","20.7","667","1.7","319","1.4"," "," "," "," ","N"," "," "," "," "," "," "," "," "
"166","2014-09-10","1100","26.4","14.5","0.55","455",,"0","48","0.5","20.9","796","1.7","321","1.4"," "," "," "," ","N"," "," "," "," "," "," "," "," "
"166","2014-09-10","1200","29","13","0.65","500",,"0","37","1.3","21.4","861","1.5","343","1.7"," "," "," "," ","N"," "," "," "," "," "," "," "," "
"70","2014-09-10","1000","24.1","13.8","0.46","380","0.45","0","52","1.6","20.6","650","1.6","287","1.8"," "," "," "," "," "," "," "," "," "," "," "," "," "
"70","2014-09-10","1100","26.3","14","0.57","461","0.56","0","47","1.3","20.7","771","1.6","306","1.7"," "," "," "," "," "," "," "," "," "," "," "," "," "
"70","2014-09-10","1200","28.7","14.4","0.63","503","0.63","0","42","0.8","20.8","834","1.6","338","1.4"," "," "," "," "," "," "," "," "," "," "," "," "," "
"71","2014-09-10","1000","23.8","13.6","0.44","371","0.43","0","53","1.1","21","632","1.6","323","1.3"," "," "," "," "," "," "," "," "," "," "," "," "," "
"71","2014-09-10","1100","26.3","12.9","0.57","459","0.56","0","43","1.6","21.1","765","1.5","307","1.7"," "," "," "," "," "," "," "," "," "," "," "," "," "
"71","2014-09-10","1200","28.3","11.3","0.65","500","0.64","0","35","1.7","21.2","830","1.3","315","1.9"," "," "," "," "," "," "," "," "," "," "," "," "," "
"191","2014-09-10","1000","24.4","9.3","0.44","361","0.42","0","38","0.6","20.6","600","1.2","310","1.1"," "," "," "," "," "," "," "," "," "," "," "," "," "
"191","2014-09-10","1100","28.4","8","0.57","444","0.54","0","28","0.6","20.6","721","1.1","195","1.1"," "," "," "," "," "," "," "," "," "," "," "," "," "
"191","2014-09-10","1200","31.2","6","0.65","485","0.62","0","21","0.4","20.8","781","0.9","332","1.4"," "," "," "," "," "," "," "," "," "," "," "," "," "
"167","2014-09-10","1000","25.2","10.9","0.46","360","0.45","0","41","1.4","21.6","618","1.3","347","1.7"," "," "," "," "," "," "," "," "," "," "," "," "," "
"167","2014-09-10","1100","27.4","10.5","0.58","436","0.58","0","35","2.1","25.1","727","1.3","346","2.3"," "," "," "," "," "," "," "," ","R"," "," "," "," "
"167","2014-09-10","1200","29.3","11.7","0.66","482","0.65","0","34","2.3",,"793","1.4","353","2.6"," "," "," "," "," "," "," "," ","S"," "," "," "," "
"140","2014-09-10","1000","24.1","13.6","0.46","378","0.45","0","52","1.4","19.9","650","1.6","327","1.6"," "," "," "," "," "," "," "," "," "," "," "," "," "
"140","2014-09-10","1100","27.4","12.7","0.57","457","0.56","0","40","0.4","19.9","777","1.5","286","1.2"," "," "," "," "," "," "," "," "," "," "," "," "," "
"140","2014-09-10","1200","29.7","11.1","0.67","495","0.67","0","32","1.9","19.9","835","1.3","341","2.2"," "," "," "," "," "," "," "," "," "," "," "," "," "
"139","2014-09-10","1000","27.3","9.9",,,,"0","33","0.6","21.8","591","1.2","51","0.8"," "," ","N","N","N"," "," "," "," "," "," "," "," "
"139","2014-09-10","1100","28","6.8",,,,"0","26","1","21.2","703","1","53","1.4"," "," ","N","N","N"," "," "," "," "," "," "," "," "
"139","2014-09-10","1200","30.1","5.8",,,,"0","22","1.1","21.6","758","0.9","37","1.6"," "," ","N","N","N"," "," "," "," "," "," "," "," "
Loading

0 comments on commit 15bd719

Please sign in to comment.