Git Product home page Git Product logo

hydromodelbuilder's People

Contributors

connectedsystems avatar daniel-partington avatar mjasher avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

hydromodelbuilder's Issues

Split up God class and class file

flopyInterface is currently ~2744 lines long, and as a consequence is hard to read through.

I suggest the following changes:

  1. Separate the classes defined in the file into separate class files.
  2. There seems to be analysis/visualization helper methods defined within ModflowModel().
    Extract these out into a separate file and import them in as necessary
  3. Remove commented out code
  4. If certain methods only relate to a specific model implementation (e.g. SFR) then these could be split out into a separate class that inherits from a base class (or we could use composition)

Any other suggestions @mjasher?

Files not being written in reproject.py

@ConnectedSystems

When reproject_layer from reproject.py is called from GDALInterface, the new reprojected shapefile is not being written to copy_dest. This works when the module is run standalone but not when called. Need to sort out so that there is a record of transforms and to prevent recalling the reprojection every time GWModelBuilder class object is being used, i.e. every time a build script is run for a groundwater model.

Note that the function reproject_layer is still returning a perfectly usable GDAL object that works as expected in mapping the shapefile to the model grid, it is just not keeping the record of the reprojection as is desired.

Consolidate file read/write functions

Expanding on issue #8 there are multiple places where identical or near identical methods are being defined which handle file/data reading and writing.

e.g.
These are identical to each other

It would be great if we could consolidate these.

Raster to mesh mapping issues

As part of the given spec, a step is to "adjust the height of an inactive cell".
In the context where the current raster is the third one (i.e. Raster 3), the "bottom of this inactive cell should move to become half the height between the bottom of Raster 4 and Raster 1".

I cannot see where this happens in the current version of the function, although

proposed_heights = (top_merge_locs - (next_j * (merge_diff / next_j)))

Looks like it's calculating the height adjustments. For full context (see here)

Additionally, the function as it is currently doesn't appear to check if the new heights are valid (i.e. greater than the minimum thickness value - or should that be greater than or equal to?)

"In the case of it being two overlying inactive cells then it should split them up into three equal parts"

I cannot determine where this happens currently.

Ancillary simplification suggestions:
reclassIsolatedCells() is like a median filter with an extra step that reclassifies cells with value of -1 if any neighbouring cell is -1, where -1 is the value that indicates an invalid cell.

Something like the below can be adapted for this purpose, which would drastically reduce the amount of code. Here, it only does the median filtering (replacement of isolated cells with surrounding values) so it needs to be modified to do the invalid neighbour check.

def filter_isolated_cells(arr):
    """
    Adapted from:
    * https://stackoverflow.com/questions/41550979/fill-holes-with-majority-of-surrounding-values-python
    * https://docs.scipy.org/doc/scipy-0.16.1/reference/generated/scipy.ndimage.filters.median_filter.html
    """
    labels, count = label(arr)
    return ndimage.median_filter(labels, 1)
# End filter_isolated_cells()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.