tools

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RasRE fileExtMatchers = fileExtMatchers{
	Geom:        regexp.MustCompile(".g[0-9][0-9]"),
	Plan:        regexp.MustCompile(".p[0-9][0-9]"),
	Steady:      regexp.MustCompile(".f[0-9][0-9]"),
	Unsteady:    regexp.MustCompile(".u[0-9][0-9]"),
	QuasiSteady: regexp.MustCompile(".q[0-9][0-9]"),
	AllFlow:     regexp.MustCompile(".[fqu][0-9][0-9]"),
	Output:      regexp.MustCompile(".O[0-9][0-9]"),
	SteadyRun:   regexp.MustCompile(".r[0-9][0-9]"),
	UnsteadyRun: regexp.MustCompile(".x[0-9][0-9]"),
	AllFlowRun:  regexp.MustCompile(".[rx][0-9][0-9]"),
	Projection:  regexp.MustCompile(".pr[oj]"),
}

Functions

func GetForcingData

func GetForcingData(fd *ForcingData, fs filestore.FileStore, flowFilePath string, c chan error, mu *sync.Mutex)

Get Forcing Data from steady, unsteady or quasi-steady flow file.

func GetGeospatialData

func GetGeospatialData(gd *GeoData, fs filestore.FileStore, geomFilePath string, sourceCRS string, destinationCRS int) error

GetGeospatialData ...

func ReadFirstLine

func ReadFirstLine(fs filestore.FileStore, fn string) (string, error)

Types

type BoundaryCondition

type BoundaryCondition struct {
	RS          string      `json:",omitempty"`            // only exists for unsteady rivers
	BCLine      string      `json:"bc_line,omitempty"`     // only exists for unsteady storage and 2D areas
	Description string      `json:"description,omitempty"` // only exists for Rules, not implemented yet
	Type        string      `json:"type"`
	Data        interface{} `json:"data"`
}

Boundary Condition.

type Connection

type Connection struct {
	Description string      `json:"Description"`
	UpSA        string      `json:"Up Area"`
	DnSA        string      `json:"Dn Area"`
	WeirWidth   float64     `json:"Weir Width"`
	WeirElev    maxMinPairs `json:"Weir Elevations"`
	NumGates    int         `json:"Num Gates"`
	Gates       []gates
	NumConduits int        `json:"Num Culvert Conduits"`
	Conduits    []conduits `json:"Culvert Conduits"`
}

Store HEC-RAS SA/2D Area Connections

type ControlFiles

type ControlFiles struct {
	Paths []string
	Data  map[string]interface{} // placeholder
}

ControlFiles ...

type DateTime

type DateTime struct {
	Date  string `json:"date,omitempty"`
	Hours string `json:"hours,omitempty"` // should not be int/float or else 0015 hours will become 15 hours
}

type Features

type Features struct {
	Rivers              []VectorFeature
	XS                  []VectorFeature
	Banks               []VectorFeature
	StorageAreas        []VectorFeature
	TwoDAreas           []VectorFeature
	Mesh                []VectorFeature
	HydraulicStructures []VectorFeature
	Connections         []VectorFeature
	BCLines             []VectorFeature
	BreakLines          []VectorFeature
}

Features ...

type FlowFileContents

type FlowFileContents struct {
	Path                string
	Hash                string
	FileExt             string //`json:"File Extension"`
	FlowTitle           string //`json:"Flow Title"`
	ProgramVersion      string //`json:"Program Version"`
	NProfiles           string //`json:"Number of Profiles"`
	ProfileNames        string //`json:"Profile Names"`
	UpdatedProfileNames string //`json:"Updated Profile Names"`
	Notes               string //`json:"Notes"`
}

FlowFileContents keywords and data container for ras flow file search

type ForcingData

type ForcingData struct {
	Steady        map[string]SteadyData   `json:"Steady,omitempty"`
	QuasiUnsteady map[string]interface{}  `json:"QuasiUnsteady,omitempty"` // to be implemented
	Unsteady      map[string]UnsteadyData `json:"Unsteady,omitempty"`
}

Main struct for focing data.

type ForcingFiles

type ForcingFiles struct {
	Paths []string
	Data  map[string]interface{} // placeholder
}

ForcingFiles ...

type GeoData

type GeoData struct {
	Features     map[string]Features
	Georeference int
}

GeoData ...

type GeomFileContents

type GeomFileContents struct {
	Path           string
	Hash           string
	FileExt        string                 `json:"File Extension"`
	GeomTitle      string                 `json:"Geom Title"`
	ProgramVersion string                 `json:"Program Version"`
	Description    string                 `json:"Description"`
	Structures     []hydraulicStructures  `json:"Hydraulic Structures"`
	StorageAreas   map[string]StorageArea `json:"Storage Areas"`
	TwoDAreas      map[string]TwoDArea    `json:"2D Areas"`
	Connections    map[string]Connection  `json:"Connections"`
	Notes          string
}

GeomFileContents keywords and data container for ras flow file search

type GeometryFiles

type GeometryFiles struct {
	Paths              []string
	FeaturesProperties map[string]interface{} // placeholder
	Georeference       interface{}            // placeholder
}

GeometryFiles is a general type that should contain all data pulled from the models spatial files

type Hydrograph

type Hydrograph struct {
	TimeInterval       string      `json:"time_interval,omitempty"`
	EndRS              string      `json:"flow_distribution_last_RS,omitempty"` // flow will be distributed from RS to EndRS. Valid for Reaches with Uniform Lateral Inflow or Groundwater Interflow
	Values             interface{} `json:"values,omitempty"`
	UseDSS             bool        `json:"use_dss"`
	DSSFile            string      `json:"dss_file,omitempty"`
	DSSPath            string      `json:"dss_path,omitempty"`
	UseFixedStart      bool        `json:"fixed_start"`
	FixedStartDateTime *DateTime   `json:"fixed_start_date_time,omitempty"` // pointer to have zero value, so that omitempty can work
}

Hydrograph Data. Can be Flow, Stage, Precipitation, Uniform Lateral Inflow, Lateral Inflow, Ground Water Interflow, or Gate Opening Hydrograph.

type InputFiles

type InputFiles struct {
	ControlFiles        ControlFiles
	ForcingFiles        ForcingFiles
	GeometryFiles       GeometryFiles
	SimulationVariables interface{} // placeholder
	LocalVariables      interface{} // placeholder
}

InputFiles is a general type that should contain all data pulled from the models input files

type Model

type Model struct {
	Type               string
	Version            string
	DefinitionFile     string
	DefinitionFileHash string
	Files              ModelFiles
}

Model is a general type should contain all necessary data for a model of any type.

type ModelFiles

type ModelFiles struct {
	InputFiles        InputFiles
	OutputFiles       OutputFiles
	SupplementalFiles SupplementalFiles
}

ModelFiles ...

type OutputFiles

type OutputFiles struct {
	Paths           []string
	ModelPrediction interface{} // placeholder
	RunFiles        []string
	RunLogs         []string
}

OutputFiles is a general type that should contain all data pulled from the models output files

type PlanFileContents

type PlanFileContents struct {
	Path            string
	Hash            string
	FileExt         string //`json:"File Extension"`
	PlanTitle       string //`json:"Plan Title"`
	ShortIdentifier string //`json:"Short Identifier"`
	ProgramVersion  string //`json:"Program Version"`
	GeomFile        string //`json:"Geom File"`
	FlowFile        string //`json:"Flow File"` // unsteady or steady both flow files are stored as FlowFile in HEC RAS plan file, replicating the same here
	FlowRegime      string //`json:"FlowRegime"`
	Description     string //`json:"Description"`
	Notes           string
}

PlanFileContents keywords and data container for ras plan file search

type PrjFileContents

type PrjFileContents struct {
	Hash            string
	ProjTitle       string   //`json:"Proj Title"`
	PlanFile        []string //`json:"Plan File"`
	FlowFile        []string //`json:"Flow File"`
	QuasiSteadyFile []string //`json:"QuasiSteady File"`
	UnsteadyFile    []string //`json:"Unsteady File"`
	GeomFile        []string //`json:"Geom File"`
	Units           string   //`json:"Units"`
	CurrentPlan     string   //`json:"Current Plan"`
	Description     string   //`json:"Description"`

} //

PrjFileContents keywords and data container for ras project file search

type Profile

type Profile struct {
	Name                  string
	BoundaryConditions    map[string]*map[string]BoundaryCondition
	Flows                 map[string][]RSFlow
	StorageAreaElevations []StoAreaElevation
}

Steady Flow Profile.

type ProjectMetadata

type ProjectMetadata struct {
	ProjFilePath     string
	ProjFileContents PrjFileContents    //`json:"Project Data"`
	PlanFiles        []PlanFileContents //`json:"Plan Data"`
	FlowFiles        []FlowFileContents //`json:"Flow Data"`
	GeomFiles        []GeomFileContents //`json:"Geometry Data"`
	Projection       string             //`json:"Projection"`
	Notes            string             //`json:"Notes"`
}

ProjectMetadata contains information scraped from all files listed in the .prj file

type RSFlow

type RSFlow struct {
	RS   string  `json:"river_station"`
	Flow float64 `json:"flow"`
}

River Flow Data Pair.

type RasModel

type RasModel struct {
	Type           string
	Version        string
	FileStore      filestore.FileStore
	ModelDirectory string
	FileList       []string
	Metadata       ProjectMetadata
}

RasModel ...

func NewRasModel

func NewRasModel(key string, fs filestore.FileStore) (*RasModel, error)

NewRasModel ...

func (*RasModel) GeospatialData

func (rm *RasModel) GeospatialData(destinationCRS int) (GeoData, error)

GeospatialData ...

func (*RasModel) Index

func (rm *RasModel) Index() Model

Index ...

func (*RasModel) IsAModel

func (rm *RasModel) IsAModel() bool

IsAModel ...

func (*RasModel) IsGeospatial

func (rm *RasModel) IsGeospatial() bool

Checks if a model is geospatial or not. Versions less than 4.0 are not considered geospatial

func (*RasModel) ModelType

func (rm *RasModel) ModelType() string

ModelType ...

func (*RasModel) ModelVersion

func (rm *RasModel) ModelVersion() string

ModelVersion ...

type RatingCurve

type RatingCurve struct {
	Values  [][2]float64 `json:"values,omitempty"`
	UseDSS  bool         `json:"use_dss"`
	DSSFile string       `json:"dss_file,omitempty"`
	DSSPath string       `json:"dss_path,omitempty"`
}

Rating Curve

type SteadyData

type SteadyData struct {
	FlowTitle      string
	ProgramVersion string
	Profiles       []Profile
}

Steady Data.

type StoAreaElevation

type StoAreaElevation struct {
	StorageArea string  `json:"storage_area"`
	Elevation   float64 `json:"elevation"`
}

Storage Area Elevation Data Pair.

type StorageArea

type StorageArea struct {
	NumBCLines int      `json:"Num BC Lines"`
	BCLines    []string `json:"BC Lines"`
}

type SupplementalFiles

type SupplementalFiles struct {
	Paths             []string
	Visulizations     interface{} // placeholder
	ObservationalData interface{} // placeholder
}

SupplementalFiles is a general type that should contain all data pulled from the models supplemental files

type TwoDArea

type TwoDArea struct {
	NumCells   int      `json:"Num Mesh Cells"`
	NumBCLines int      `json:"Num BC Lines"`
	BCLines    []string `json:"BC Lines"`
}

type UnsteadyBoundaryConditions

type UnsteadyBoundaryConditions struct {
	// There can be many boundary conditions for the same element
	Reaches     map[string][]BoundaryCondition
	Areas       map[string][]BoundaryCondition
	Connections map[string][]BoundaryCondition
	// Only one boundary condition for each element in pumps
	PumpStations map[string]BoundaryCondition
}

Unsteady Boundary Conditions

type UnsteadyData

type UnsteadyData struct {
	FlowTitle          string
	ProgramVersion     string
	InitialConditions  interface{} // to be implemented
	BoundaryConditions UnsteadyBoundaryConditions
	MeterologicalData  interface{} // to be implemented
	ObservedData       interface{} // to be implemented // added in version 6.2
}

Unsteady Data

type VectorFeature

type VectorFeature struct {
	FeatureName string                 `json:"feature_name"`
	Fields      map[string]interface{} `json:"fields"`
	Geometry    []uint8                `json:"geometry"`
}

VectorFeature ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL