ChiHungLam / dsm2-grid-map

Automatically exported from code.google.com/p/dsm2-grid-map
0 stars 0 forks source link

Fix fromChannels method to output XSection info #24

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
create a channel from scratch with xsections. use the fromChannels method 
on Tables to convert it to InputTables.

None of the xsection tables are output.

{{{
>>> from gov.ca.dsm2.input.parser import Parser
>>> from gov.ca.dsm2.input.model import *
>>> c1 = Channel()
>>> c1.setId("1"); c1.setUpNodeId("2"); c1.setDownNodeId("3"); 
c1.setLength(12500); c1.setMannings(0.02); c1.setDispersion(1.0)
>>> xsect1 = XSection();
>>> x1layer1 = XSectionLayer(); x1layer1.setArea(0); 
x1layer1.setElevation(-10.0); x1layer1.setTopWidth(10); 
x1layer1.setWettedPerimeter(10);
>>> x1layer2 = XSectionLayer(); x1layer2.setArea(50); 
x1layer2.setElevation(-5.0); x1layer2.setTopWidth(10); 
x1layer2.setWettedPerimeter(20);
>>> xsect1.setChannelId(c1.getId()); xsect1.setDistance(0.25); 
xsect1.addLayer(x1layer1); xsect1.addLayer(x1layer2)
>>> c1.addXSection(xsect1)
>>> channels = Channels()
>>> channels.addChannel(c1)
>>> from gov.ca.dsm2.input.parser import Tables
>>> tables = Tables()
>>> tables.fromChannels(channels)
[gov.ca.dsm2.input.parser.InputTable@e14ebc, 
gov.ca.dsm2.input.parser.InputTable@1f82253]
>>> channel_input_tables = tables.fromChannels(channels)
>>> for table in channel_input_tables:
...     print table.toStringRepresentation()
...     
CHANNEL
CHAN_NO LENGTH  MANNING DISPERSION  UPNODE  DOWNNODE
1   12500.0 0.02    1.0 2   3
END

CHANNEL_GIS
ID  INTERIOR_LAT_LNG
1   
END

}}}

Original issue reported on code.google.com by karajdaar@gmail.com on 26 Jan 2010 at 5:48

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r97.

Original comment by sandhuda...@gmail.com on 26 Jan 2010 at 6:47