-
Notifications
You must be signed in to change notification settings - Fork 1
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
PE_Obs and SR_Obs for nmonth table #21
Comments
The calculated values are stored in settings.xml (same as jh_coef). There are 12 values returned for each parameter. Have a separate tool (form) for calculating PE_Obs and SR_Obs. Put it under the Timberline tool, name it "PE_Obs and SR_Obs Tool". On the export form, add the dates of each parameter that was last calculated. The parameters should be present at the settings.xml file and the parameter template doesn't have to have these two fields in the input template. The export tool will determine if it's an insert of update during export. |
SR source data is a point featureclass (in a gdb or a shapefile). The PE source data has 12 rasters in ArcInfo GRID format or as rasters in gdb. The raster files must follow a certain naming convention. Users need to select the folder containing the January raster for the execution. The tool will parse the prefix and suffix of the other rasters' names. |
The export tool still allow export even if these two parameters are not present in the settings.xml file |
The PE rasters and solar radiation station point featureclass are available at D:\NRCS\GIS\Static\nmonth_PE_SR on CH459C03. There are two sets of PE rasters: one in the nmonth_databin,gdb and the other is a set of ArcInfo GRID in the nmonth_PE_SR folder (workspace). |
Add new form/button for PE and SR Obs tool
|
|
See http://forums.esri.com/Thread.asp?c=93&f=992&t=186118. I'm not sure if that's an easy approach. You can also try the near geoprocessor. The input needs to be a point featureclass. |
Seeking guidance on how to handle AOI-level parameters for nmonths table in export file. Current AOI-level parameters are jh_coef, pe_obs, and sr_obs. If there is an error in calculation for any month, I populate the parameter/month value in memory with -9999. Should all 3 of these parameters ALWAYS be included in the nmonths table? If the column exists in the input template, its contents will be overwritten with the output of the calculation. If the column doesn't exists in the input template, the column will be added to the export file. Is the answer different if there is an error in the calculation? That is, if any of the values are -9999. I have some error handling in the export form now that warns of the jh_coeff calculation is invalid. That will need to be adjusted to accommodate additional parameters. |
The message in the Tell me more dialog looks good, except the extra "to" in the first sentence. The conversion from mm to inch is correct. Alternatively, you can just divide the mm value by 25.4. We do need to differentiate 28, 30, and 31 days in the different months. The jh_coef must always be in the output table. Can you make pe_obs and sr_obs optional (but include them as the default)? The export behavior you described is correct. Ok, write -9999 to the cache and warn the user during export. |
How do we make pe_obs and sr_obs optional? Do you mean that we only include them if they have been calculated for the AOI? Or should we add a checkbox to the export form that allows the user to turn this on and off? Checked by default? |
How about add the following checkbox to the export tool (see #26)? "Export observed PE and SR to the nmonth table." |
See issue #26 for screenshot of updated parameter export tool. We originally said we would put the date last calculated for these parameters, but this screen is getting busy. Added a comment referring users to the PE_Obs_SR_Obs tool to manage these parameters, With this design, it is all or nothing. They either export both or none. Is this okay? Also plan some validation on this checkbox to pop an error message if they try to include the parameters and they are missing. |
The current GUI design and checkbox options (see #26 screenshot) are good. |
The datasets provided for PE has a different spatial reference than BAGIS aoi_v. The PE data uses Clarke_1866_Albers. aoi_v uses GCS_North_American_1983/NAD_1983_Albers. Should the PE data need to be reprojected to match grid_v? |
I am using the number of days from each month in 2015. ie: not a leap year. This is configurable in the code. Could be current year or ... Let me know if this should change. |
Finish up PE calculations; Add status box
A new nmonth_Databin.gdb is copied to D:\NRCS\GIS\Static\nmonth_PE_SR on CH459C03. The layers that are in the "USA_Contiguous_Albers_Equal_Area_Conic_USGS_version" projection have a suffix of USGS_Albers. |
Add MessageBox notification that calculations are complete
VB .NET has built-in functionality to determine the number of days in a month. https://msdn.microsoft.com/en-us/library/system.datetime.daysinmonth(v=vs.100).aspx. The only variation should be for leap years and the original fortran did not use leap years. This tool is done. I just ran it against the reprojected layers and it worked fine. |
Ran the tool on the Santa Fe AOI and got a zonalstats error (12 errors total) on PE calculation. The AOI is posted at ftp://basins.geog.pdx.edu/BAGIS/BAGIS_aois/Santa_Fe_R_nr_Santa_Fe.zip. Please give it a test. This is one of the AOIs that you need to use SR and PE layers that have different projections. |
I am stumped. The only difference I can find between this AOI and Teton (which works) is the projection of aoi_v: NAD_1983_Albers vs Projected coordinate system: USA_Contiguous_Albers_Equal_Area_Conic_USGS_version. However, I have tried re-projecting aoi_v to match the PE layer and vice versa but it still fails. I am testing using the Zonal Statistics as Table tool interactively in ArcMap. This tool does not return an error message, it just fails. When I try to run the PE_Obs calculation using the add-in, this is the error message returned by the GP when it runs the ZonalStatisticsAsTable tool: I've added both layers to the viewer, and aoi_v falls well within the boundaries of the PE01 raster. Actually, the AOI falls completely within a single cell of PE01. Is this a problem? My suggestion would be to provide both layers to ESRI to see if they can get the ZonalStatisticsAsTable tool to run. Or maybe you can? |
I think this is the problem - "AOI falls completely within a single cell of PE01" Maybe the "center" of the cell falls outside the AOI so their intersection returns a null. How about creating a buffer of the AOI if its area is smaller than 2 pixels on the PE layer (around 200 square miles)? Set the buffer distance to 8 km. |
It appears that the area of the AOI is the problem. I tried an 8K buffer on this particular AOI and it failed to complete. Dropped it down to 4K and that worked. The area(s) of the AOI's respectively are 47,466 sq km and 242,543 sq km. A cell area is 272,481 sq km. I used the 4K buffered AOI as input to the Zonal Statistics tool and that worked as well. So, I'm having trouble developing an algorithm that we can add to the code. We can get the linear unit(s) from both layers, the area of the aoi polygon, and the area of a cell on the PE layer. But I'm not sure how to derive a reasonable buffer distance from this information. We don't have any information about the shape of the AOI (width v length). If the distance is too big relative to the AOI area, the buffer son't be created. Thoughts? |
An alternative approach is to use the centroid of the AOI boundary to extract values from the PE layers when the AOI is too small. This approach doesn't require us to determine a buffer distance. |
If we did this, would we just return the value of the cell that was located at the centroid of the AOI if the AOI area were < 75% of the cell area? With the PE tool we normally extract the mean value of the cells for each AOI using the zonal statistics tool. |
Yes, use the values directly. This approach is for AOIs with area < 200% of the cell area. I think 75% is not enough to catch most cases that the "clipped" PE layers are empty. |
Conditionally use centroid instead of zonal stats if AOI is too small relative to PE cell size
Use AOI centroid instead of zonal stats if AOI area < 200% of raster cell area
Updated PE calculation to use value of cell at centroid of AOI if AOI area is < 200% of the cell area. This change will be included with the next release of BAGIS-P. |
The output function needs to create a new .csv file (obs_monthly_pe_sr.csv) and package the file with the other output files (i.e., parameter filr, resampled HRU and DEM ASCII files) in the zip file. There is no need to remove the PET and SR from the parameter file's nmonth table. The file format of obs_monthly_pe_sr.csv) is: @t,obs_monthly |
Can you either attach a copy of a valid obs_monthly_pe_sr.csv to this issue or e-mail it to me? This would be easier to work with than just the text. Thanks! |
The export parameters form has a checkbox "Export observed Potential Evaporation and Solar Radiation to the nmonths table". Should we update this to say "Include observed Potential Evaporation and Solar Radiation in export file" ? I assume we include this file if the user checks the "Output parameter file only" checkbox? Also, I haven't looked at the code yet but because this is a toggle, chances are it would not be difficult to stop adding these parameters to the nmonths table which might avoid confusion in the future. |
Note: I am changing the parameter names to match what is in the provided .csv. If you have older AOI's with PE and SR calculated, you will have to recalculate. |
@jdduh This is almost done. Due to the form design, I decided to write the obs_monthly_pe_sr.csv directly to the zip folder. Thus, this file is NOT created when the "Output parameter file only" checkbox is checked. The export form has a field for specifying the output parameter .csv file name. Since the pe_sr file name is always the same, I was was worried that if there were > 1 aoi parameter files in a folder and we wrote the file alongside the parameter.csv file the user wouldn't know which aoi parameter file the obs_monthly_pe_sr.csv was associated with. Waiting for you to answer my previous questions about the form label and if it is okay to stop adding these parameters to the nmonths table before posting a new version of BAGIS-P. |
Please keep the PET and SR in the nmonth table. It's fine to update their parameter names. These two parameters are not directly used in PRMS/eWSF for modeling purpose. They are used to calibrate model outputs in a different eWSF menu/dialog window. Please update form label as you suggested. One AOI has one unique set of PET and SR values. The values are not affected by HRU delineation or parameters calculated. Can you still create the csv when "Output parameter file only" checkbox is checked? You can choose to either overwrite or not creating a new file when the file exists. |
Ok, I changed my mind in 2 seconds. Please don't create the PET & SR file when the "Output parameter file only" checkbox is checked. First, the PET & SR can be found in the nmonth table of the parameter file. Second, the parameter files from different AOIs might be written to the same output folder. |
Agreed on not creating PET & SR files alongside the parameter export for the second reason you mentioned. I have posted v1.9.7 of BAGIS-P which includes this new file export. |
Per George's request to add the two parameter to the PRMS parameter table,
Thanks for sending the files. This message is to summarize the steps for calculating the two new nmonth variables: PE_Obs and SR_Obs. I also have my questions highlighted.
We got the maps from a colleague at the National Weather Service. In a paper on the use of the data it was described as
"The basin mean
monthly PET values were calculated from PET maps
provided by the NWS. The NWS derived the PET values
from the free water evaporation atlas of
Farnsworth et al. (1982). These PET maps were used
for calibration and evaluation purposes in this study
because these values are available for the entire U.S.
and the ability to apply this calibration procedure to
numerous basins across the U.S. depends on having a
data source for PET."
The output is inch/day and you are correct, the conversion should be 25.4
The radiation unit is langleys/day or calories/sq cm/day for each month of the year.
In the same paper with the PE description SR is described as:
"Measured monthly SR values are available for 217
stations in the U.S. (http://rredc.nrel.gov/solar/old_
data/nsrdb/redbook/mon2/). A data set of mean
monthly SR values at each of the climate station sites
(SNOTEL and NWS) in the U.S. was developed. A
multiple linear regression (MLR) was developed
between measured monthly SR values at the 217 stations
and independent variables (climate statistics
calculated using climate stations co-located with the
measured solar radiation). For each month a separate
MLR equation was developed, choosing from the following
independent variables: latitude, longitude, elevation,
mean precipitation (days > 0˚C), mean
precipitation, number of rain days, mean maximum
temperature, and the difference between mean maximum
and mean minimum temperature. Adjusted R2
values ranged from 0.83-0.98. Mean monthly SR
values were calculated at each SNOTEL and NWS climate
station site using the monthly MLR equations.
As noted earlier in this paper, there is a lack of
additional data sources for model calibration and
evaluation in nonresearch oriented basins. Mean
monthly values of SR are used for calibration and
evaluation purposes in this study because these values
are available for the entire U.S. and the ability to
apply this calibration procedure to numerous basins
across the U.S. depends on having a data source for
SR in each of these basins.
SR output from the station closest to the centroid of
the Yampa River basin (23 km) was used as the calibration
data set for the first step in the calibration
process. These SR values are referred to as interpolated
values in the text."
The text was updated successfully, but these errors were encountered: