<?php
require_once "../../../config/settings.inc.php";
define("IEM_APPID", 81);
include_once "../../../include/myview.php";
$t = new MyView();
require_once "../../../include/forms.php";

$t->title = "RWIS Soil Probe Data Download";
$t->iemss = True;

$ys = yearSelect(2008, date("Y"), "year1");
$ms = monthSelect("", "month1");
$ds = daySelect("", "day1");
$hs = gmtHourSelect("", "hour1");

$ys2 = yearSelect(2008, date("Y"), "year2");
$ms2 = monthSelect("", "month2");
$ds2 = daySelect("", "day2");
$hs2 = gmtHourSelect("", "hour2");

$ar = array(
    "Etc/UTC" => "Coordinated Universal Time (UTC)",
    "America/New_York" => "America/New_York (EST/EDT)",
    "America/Chicago" => "America/Chicago (CST/CDT)",
    "America/Denver" => "America/Denver (MST/MDT)",
    "America/Los_Angeles" => "America/Los_Angeles (PST/PDT)",
    "America/Anchorage" => "America/Anchorage (AKST/AKDT)",
);
$tzselect = make_select("tz", "Etc/UTC", $ar);

$t->content = <<<EOM
<ol class="breadcrumb">
 <li><a href="/RWIS/">RWIS Homepage</a></li>
 <li class="active">Iowa Soil Data Download</li>
</ol>

<p>This page provides a download of the soil temperature information collected
by some of the Iowa RWIS sites.  This page was updated on 10 Feb 2021 to use
more explicit column headings within the download file to denote the depth
the temperature reading in Fahrenheit was recorded.</p>

<p><a href="/cgi-bin/request/rwis.py?help" class="btn btn-primary"><i class="bi bi-file-text" aria-hidden="true"></i>
Backend documentation</a> exists for those wishing to script against this service.</p>

<form method="GET" action="/cgi-bin/request/rwis.py">
<div class="form2url"></div>
<input type="hidden" name="network" value="IA_RWIS">
<input type="hidden" name="src" value="soil">
<input type="hidden" name="vars" value="tmpf_1in">
<input type="hidden" name="vars" value="tmpf_3in">
<input type="hidden" name="vars" value="tmpf_6in">
<input type="hidden" name="vars" value="tmpf_9in">
<input type="hidden" name="vars" value="tmpf_12in">
<input type="hidden" name="vars" value="tmpf_18in">
<input type="hidden" name="vars" value="tmpf_24in">
<input type="hidden" name="vars" value="tmpf_30in">
<input type="hidden" name="vars" value="tmpf_36in">
<input type="hidden" name="vars" value="tmpf_42in">
<input type="hidden" name="vars" value="tmpf_48in">
<input type="hidden" name="vars" value="tmpf_54in">
<input type="hidden" name="vars" value="tmpf_60in">
<input type="hidden" name="vars" value="tmpf_66in">
<input type="hidden" name="vars" value="tmpf_72in">

<table>
<tr><td width="50%">

<p><h3>1. Select Station:</h3><br>

<p>Note that not all stations have soil probe data.</p>

<div id="iemss" data-network="IA_RWIS"></div>


<p><h3>2. Select Start/End Time:</h3><br>
<i>Times are in UTC.  Archive starts in June 2008.</i>
<table>
  <tr>
    <td></td>
    <th>Year</th><th>Month</th><th>Day</th>
    <th>Hour</th>
  </tr>

  <tr>
    <th>Start:</th>
    <td>{$ys}</td>
    <td>{$ms}</td>
    <td>{$ds}</td>
    <td>{$hs}
    <input type="hidden" name="minute1" value="0"></td>
  </tr>

  <tr>
    <th>End:</th>
    <td>{$ys2}</td>
    <td>{$ms2}</td>
    <td>{$ds2}</td>
    <td>{$hs2}
    <input type="hidden" name="minute2" value="0"></td>
    </tr>
</table>

</td><td valign="TOP">

<p><h4>3. Timezone of Timestamps</h4>
   <i>This controls the timezone used for presenting the timestamps in the
    downloaded file.</i>
   <br />{$tzselect}</p>
            
<p><h3>4. How to view?</h3><br>
<select name="what">
  <option value="txt">Download to Disk</option>
  <option value="view">View on-line
</select>

<p><h3>5. Data Delimitation:</h3><br>
How shall the output values be seperated?
<br><select name="delim">
    <option value="comma">Comma
    <option value="space">Space
    <option value="tab">Tab
   </select>

<p>
<h3>6. Include Lat / Lons?</h3><img src="/images/gisready.png"><br>
 <select name="gis">
   <option value="no">No
   <option value="yes">Yes
 </select>

</td></tr></table>

<p><h3>Submit Form:</h3><br>
<input type="submit" value="Process Data Request">
<input type="reset">
</form>
EOM;
$t->render('single.phtml');
