Skip to content

FaridAlmaulaui1/paraviewplus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 

Repository files navigation

About

This code is meant to automate the generation of plots, maps, slices and 3d models for urban planning. Written in Python, main visualization library used is matplotlib.

Example data can be found in the data/ folder. Some examples of plots are in Examples.md.

How to run

Each of the analysis types has its own class. The classes have functions that can be divided into the further groups, according to the GUI structure: Step 1, Step2, Step3, Step4. Step 1 is the initialization of the class. The inputs are meant to be the Ferda folder outputs: surface points, surface data, air points, air data, surface mesh. Step 2 is for selecting the areas of interest (if necessary). Step 3 is for selecting variables (ticking boxes), Step 4 is for adjusting the plot characteristics (colormaps, levels etc.) and Step 5 are functions for exporting/plotting the data.

Files

  • inputs.py (for handling input data types)
  • graphmaker.py (creating plots)
  • main.py

inputs.py

  • AirPoints --> functions for handling air points shapefile
  • SurfacePoints --> functions for handling surface points shp
  • SurfaceMesh --> functions for hangling surface triangles shp

graphmaker.py

  • TimeSeriesDemonstration --> creates plot with subplots for each selected variable, plots the selected variables for each time step (1 png for each timestep. the subplots are maps colored by the selected variable)
  • SimulationResults --> creates average of selected variable for selected areas of interest (x-axis = time, y-axis = selected variable)
  • SimulationComparison --> creates plot comparing new vs. existing design. creates plot for each selected variable and aoi.
  • UTCICategory --> plots time series of selected UTCI category (only the selected category is shown on map). creates one figure for each timestep.
  • AOIsOnMap --> plots polygons of areas of interest over map (either point map or mesh)
  • Windrose --> plots wind rose (wind directions and wind speeds of the whole area)

Examples

Time Series Demonstration for Simulation Results

image

  • class TimeSeriesDemonstration in scripts/inputs.py

  • inputs:

  • surfpoints (data/surface_point_shp.shp)

  • surfdata (data/surface_data_2021_07_15.csv)

  • airpoints (data/air_point_shp.shp)

  • airdata (data/air_data_2021_07_15.csv)

  • surfmesh (data/surface_triangles_shp.shp)

run:

    tsd = TimeSeriesDemonstration(
        surfpoints=gpd.read_file("data/surface_point_SHP.shp"),
        airpoints=gpd.read_file("data/air_point_SHP.shp"),
        surfmesh=gpd.read_file("data/surface_triangle_SHP.shp"),
        surfdata=pd.read_csv("data/surface_data_2021_07_15.csv"),
        airdata=pd.read_csv("data/air_data_2021_07_15.csv"),
    )

    tsd.run()

Notes:

airdata is too big for uploading on github. message and i will share through google drive. or just run ferda. but this script will not work without it (plotting windspeed).

To-Do:

specify output folder for saving pngs instead of showing the plots; specify variables for plotting (default are air temp, relative humidity, wind speed and utci felt temperature). adjustable number of subplots.

Result:

image

Simulation Results

image

  • class SimulationResults in scripts/inputs.py

  • inputs:

  • surface points (data/surface_point_shp.shp)

  • surface data (data/surface_data_2021_07_15.csv)

    # load data
    surfpoints = gpd.read_file("data/surface_point_shp.shp")
    surfdata = pd.read_csv("data/surface_data_2021_07_15.csv")

    # step 1: initiate the class
    sr = SimulationResults(surfpoints, surfdata)

    # step 2: add areas of interest
    sr.add_area_of_interest(aoi1)
    sr.add_area_of_interest(aoi2)
    sr.add_area_of_interest(aoi3)

    # step 3: add variables
    sr.add_variable("Tair")
    sr.add_variable("UTCI")

    # step 4: specify output folder/showing of plot
    sr.set_output_folder("paraviewplus/figs")
    sr.set_show(True)  # do you want to show the plot?
    sr.run()  # run

Notes:

Specifying output folder and showing of plot is only a proposal here (not implemented in the other classes, there is just defaults to show as of now). I thought it could be helpful when in the last step the user specifies the output folder in export. The set_show could be useful if you want to visualize the plot so that the user can then adjust the colormaps etc. (this is not really thought through yet).

Result:

utci

Simulation Comparison

image

  • class SimulationResults in grapmaker.py

  • inputs:

  • surface points (data/surface_point_shp.shp)

  • surface data (data/surface_data_2021_07_15.csv)

    surfpoints = gpd.read_file("data/surface_point_shp.shp")
    surfdata = pd.read_csv("data/surface_data_2021_07_15.csv")

    # step 1: initiate class with loading surfacepoints and surface data
    sc = SimulationComparison(surfpoints, surfdata)

    # step 2: add areas of interest (either draw or upload?) and simulation(s) for comparison
    sc.add_aoi(aoi1)
    sc.add_aoi(aoi2)
    sc.add_simulation(surfdata2)

    # step 3: select variables to plot
    sc.add_variable("Tair")
    sc.add_variable("UTCI")

    # run plotting of simulation results
    sc.run()

Result:

comparison_Air Temperature_areaD

UTCI Category

Plots maps of selected UTCI category for each timestep. Generates 1 png per each timestep in data ONLY with the selected UTCI category area.

  • class UTCICategory in graphmaker.py

  • inputs:

  • surface points (data/surface_point_shp.shp)

  • surface data (data/surface_data_2021_07_15.csv)

    # load data
    surfpoints = gpd.read_file("data/surface_point_shp.shp")
    surfdata = pd.read_csv("data/surface_data_2021_07_15.csv")

    # initiate class
    utci = UTCICategory(surfpoints, surfdata, surfmesh)

    # add category to plot
    utci.add_category('moderate')

    # run plotting
    utci.run()

Result:

image

Map of Areas of Interest

    # PLOT AREAS OF INTEREST ABOVE MAP
    aoimap = AOIsOnMap(surfpoints, surfdata, surfmesh)

    # add aois
    aoimap.add_area_of_interest(aoi1)
    aoimap.add_area_of_interest(aoi2)
    aoimap.add_area_of_interest(aoi3)
    aoimap.add_area_of_interest(aoi4)

    aoimap.set_output_folder(output_folder)
    # run with point map underneath
    aoimap.run()

    # run with mesh underneath
    aoimap.set_plot_type("mesh")
    aoimap.run()

Result:

image image

Windrose

Plotting windrose with default values for colormap and levels (bins) which can be adjusted by calling wr.set_colormap("colormap name from matplotlib") and wr.set_levels([0, 1, 2...]).

    # WINDROSE
    wr = Windrose(airpoints, airdata)

    # set output folder to save output (will be possible in all plotting functions soon)
    wr.set_output_folder(output_folder)

    # run
    wr.run()

Result:

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%