chrismarsh / chm Goto Github PK
View Code? Open in Web Editor NEWThe Canadian Hydrological Model
License: GNU General Public License v3.0
The Canadian Hydrological Model
License: GNU General Public License v3.0
Currently writes out to CHM.log.
Would be useful to have it unique to that run. Especially for large ensemble runs.
Put the CHM.log in the output_dir. Optional change its name to output_dir.log (or other naming scheme).
Code needs a license. Must be compatible with all the existing code.
BSD perhaps?
Add a configuration option to vtu2geon to mirror what @NicWayand added to mesher.
needs catch for last netcdf file, to use all hours.
For use with gridded forcing.
It would be nice if all the forcing files did not have to have same start/end dates.
Triangle allows for a user-supplied refinement function.
you write C code that examines a triangle's coordinates and area, and decides whether to refine the triangle or not.
https://www.cs.cmu.edu/~quake/triangle.u.html
I want the ability to use more than just area to produce triangles. For now, I would like to use:
Tolerance: Imagine a planar side-view of the triangle plane acting as a linear interpolant. The linear interpolant will overlapping a set of raster cells and will either extend above or below the raster cells. The tolerance can then be though of as the error between the triangle and the underlying cells.
Thus it allows for controlling the size of the triangle in areas of steep topography.
For all of this discussion, I am assuming triunsuitable()
gets a triangle t as input that has x,y coordinates. There will be no elevation, etc.
We can allow the user to specify a max area, as is currently used. The default should be much much higher, as we can spatially refine as follows. We can then allow the user to specify a max tolerance (meters).
It will be somewhat computationally expensive to do this. We can do this the same way mesher extracts parameters. Mesher produces a window into a raster that corresponds to the area the triangle intersects via gdal.
We can do the same to extract the raster DEM subarea that t overlaps. This lets us get at the elevation. Then we can compute the maximum error imposed by our triangular interpolator. Then, we can choose to refine the triangle if we exceed this tolerance.
If a module writes out a parameter, and that is used to init the mesh AND the DEM mesh has changed, there is no safe guard to prevent this.
Perhaps make a hash of the base DEM to ensure it matches?
Need to at least check the size of the parameter mesh
To add:
If paths to DEMS/&c are given to mesher, such as
parameter_files = {
'landcover': {'file': 'dems/eosd.tif',
'method': 'mode'}, # mode, mean
'svf': {'file': 'dems/wolf_svf1.tif',
'method': 'mean'
}
}
mesher fails to properly deal with the path
ERROR 4: Attempt to create new tiff file `dems/wolf_lidar1/dems/wolf_lidar1_projected.tif' failed: No such file or directory
Creating output file that is 1089P x 867L.
Traceback (most recent call last):
File "/home/chris/Documents/PhD/code/CHM/tools/mesher/main.py", line 617, in <module>
main()
File "/home/chris/Documents/PhD/code/CHM/tools/mesher/main.py", line 188, in main
subprocess.check_call(['gdalwarp %s %s -overwrite -dstnodata -9999 -t_srs "EPSG:%d"' % (dem_filename, base_dir + base_name+'_projected.tif',EPSG)], shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['gdalwarp dems/wolf_lidar1.tif dems/wolf_lidar1/dems/wolf_lidar1_projected.tif -overwrite -dstnodata -9999 -t_srs "EPSG:26908"']' returned non-zero exit status 1
netcdf files will be easier to work with than individual tiffs, especially for multiple year/scenario simulations. Also should be more space efficient.
Should be able to use the same vtu2geo tool, add option to write out to netcdf (using xarray module).
Optional length of time for individual netcdf file: time step (not efficient), 1 day, 1 month, 1 year, etc...
If option.startdate is after option.enddate, the model silently uses the entire obs period. Should throw a warning, at the minimum
Allow mesher to handle discontinuous areas (islands)
I suggest changing main.py to take an imput configuration file. That way, the code is separate from the basin/domain specific configuration info. Will make versioning simpler as well because user's configurations will not have to be committed.
Need to support ICs that are separate from parameters
Confirm that -9999 in input met files are properly treated as missing values and nan("")
is subbed in
Integrate libsnowpack into mainline
Allow as an optional input within the CHM.json configuration file, to pass a raster(?) mask of which triangles to run on (1's) and to not run. Default behavior if a mask is not provided should be to run all triangles. This will allow a user to mask out non-basin areas, or triangles near the edges that out not optimal shapes.
Where do the lapse rate values used in met interpolation come from?
Which Thornton paper?
CHM/src/modules/interp_met/Thornton_p.cpp
Line 27 in e733e03
Which Liston paper?
These values can vary greatly depending on the region.
I propose two options:
Thoughts?
Update checks to prevent user from specifying locations outside the mesh domain.
Mesher should have the option to change it's output filename based on an input parameter.
Integrate meteoio into mainline
There is an assumption that all met files have the same columns. If this isn't the case, there is a segfault on the first time step. There should at least be a check for this.
Experimental support is now enabled for lat/long input files in commit 65693a0.
Current problems
For example:
/opt/boost/boost_1_61_0/include/boost/graph/topological_sort.hpp(41): Throw in function void boost::topo_sort_visitor<OutputIterator>::back_edge(const Edge&, Graph&) [with Edge = boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int>; Graph = const boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_index_t, int, vertex>, edge>; OutputIterator = std::front_insert_iterator<std::deque<int> >] Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::not_a_dag> > std::exception::what: The graph must be a DAG.
Potential bug: CHM appears to run without error if forcing time steps are not continuous in time. For example: I am missing Aug 20th GEM forcing, in the period of 18th to 21st. I would expect this should throw an error.
Modules need to be able to specify dependency upon variables. These variables may be output from modules, therefore inter-module dependencies are required
Currently the path to output files is assumed to be relative to the run dir
"file": "BNS_out.txt",
This is an issue when you want to run multiple configurations modified via command line (it would require N station command line changes for each output file.
Suggest adding new variable point_out_dir
where point files are written.
@Chrismarsh is there already something like this? If not I will address.
Remove the need for specifying lat/long in the config file. This does not work at larger scales.
Add option to use a json file for output timeseries configuration
Splitting issue #14
There should be a mechanism to add units to variables output from a module.
Boost.units?
Other?
[debug]: Set project name to downscal_exp
[debug]: per triangle timer series storage: false
./EXP_1.sh: line 7: 17100 Segmentation fault (core dumped) ./CHM -f GEM_west_fortress.json -c config.interpolant:"nearest"
Would like to run the SnowCast over western Canada, which needs a shiny new mesh.
Remove the default behaviour which will run the code with CHM.json and require the user explicitly specify a configuration file.
Motivation is that it would remove the edge case where you accidentally run the wrong configuration file.
New Simple_Canopy module needs the iswr_diffuse
variable from slope_iswr, but slope_iswr is not run in point mode. Is there any simple way around this to enable point testing of Simple_Canopy?
Let users select which variables are saved to output files and at what interval to save them. Reduce output size and run time.
Currently exists but is lacking:
Need to do:
Currently thinking a LaTeX document, but I wonder if a github wiki is perhaps a better location for this?
CHM needs a filter to adjust all the input windspeeds to a common height prior to the interpolation
T_s_0 is in units of (C) not (K), thus this line should be < -0.5 C ( or == 0 C).
https://github.com/Chrismarsh/CHM/blob/master/src/modules/Richard_albedo.cpp#L48
start date and enddate checks fail if enddate is after startdate and on the same day.
Add to mesher:
Land/water parameter. That way certain modules can be constrained to only run over particular types (i.e. no snow module over oceans (without ice)), or lake/glacier modules only running over those triangle types.)
When inserting a new variable into the timerseries hashmap, we should automatically resize the underlying vector
Splitting #14
It would be good to have a module that calculates the time average of fluxes to diagnose the seasonality of various fluxes.
Throwing an exception from within an OpenMP thread is not allowed. Need to use something like this to clean that up
http://stackoverflow.com/questions/11828539/elegant-exceptionhandling-in-openmp
Mesher/Gdal not projecting DEM into UTM correctly. Ends outputting only 5 triangles over the large domain (Bow river basin).
DEM file at: /home/nwayand/snow_models/CHM/tools/mesher/bow_srtm.tif
mesher configuration at: https://github.com/NicWayand/CHM/blob/master/tools/mesher/main.py
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.