Giter Club home page Giter Club logo

toshi-nest's Introduction

toshi-nest

The toshi-nest is for fledgling work e.g. reusable Node components to share across TUI and other projects

to run the component playground, run yarn i-all, and then yarn run dev

How to add the package to your project

  • generate a github access token with these instructions
  • in your terminal, run npm login --scope=@gns-science --registry=https://npm.pkg.github.com, and then use your github credentials to log in.
  • add a file in the root directory of your project called .npmrc.
  • add this line to the file @gns-science:registry=https://npm.pkg.github.com/
  • in your terminal, in your project directory, run yarn add @gns-science/toshi-nest

Component Documentation

SelectControl
MultiSelect
ControlsBar
HazardCurves

toshi-nest's People

Contributors

benjamineac avatar 0qy avatar chrisbc avatar

Watchers

 avatar  avatar

Forkers

benjamineac

toshi-nest's Issues

Feature/Hazard PGA Chart Component

  • display PGA chart plot
  • user supplied series (data points) inspect SVG?? vs VisX API
  • series metadata (name, color)
  • user def axis range
  • user def height width and/or responsive
  • legend (optional)
  • test coverage e.g. find(<g>).contains

Config: eslint and tsConfig

There are some problems in the code base that eslint didn't pick up despite pre-merge testing

  • Unused Imports not allowed
  • Consistent wrapping
  • Use single quotes

Nest Feature: optimize plot font

For <GroupCurveChart /> and <GroupCurveChartResponsive /> the axis label and legend font size are not proportionate to the size of the plots. Optimize this.

Feature/MFD plot

Migrate the MFD plot component from toshi

done when:

  • MFDplot Component added
  • Documentation added to Toshi Nest Wiki including code demo, image of usage, and props table

Nest Feature: Spectra Curve Uncertainty

We want to be able to plot spectra curves with uncertainty bounds in the same way we do for hazard curves. Spectra curves are calculated on the fly depending on the PoE entry; therefore, we will need to calculate the upper1/2 and lower1/2 curves for spectra in the same way, using the corresponding hazard curves. Example output attached
spectra

Nest Feature: uncertainty for hazard curves

We want to be able to draw multiple line types on a hazard chart to communicate uncertainty. The central value ("mean") is drawn as a thick line. Uncertainty boxes are drawn by filling with a light solid color between the "0.2" and "0.8" lines. The outer uncertainty are drawn with thin lines using the "0.025" and "0.975" curves. Curve names in quotes here refer to the tags in the sample data provided. Names of these curves as provided by the API may change. Keep flexibility to draw more or fewer curves than the example.

Done when

  • plot can draw multiple curves of the same color
  • plot can alter line thickness of lines (moved to #62 )
  • plot can shade between two lines on the figure
  • plot can alter style of lines (e.g. make them dashed rather than solid) (moved to #62 )

sample plot

Nest Feature: Dynamic rescale of spectra y-axis

we would like the option for the y-axis of the spectra plot to auto-rescale to a given (settable) factor of the largest value being plotted. The default scale should be 1.2

e.g. pseudo code ylim = [0,1.2*max(y)]

Feature/SelectControl

Migrate the SelectControl component from toshi

done when:

  • SelectControl Component added
  • Documentation added to Toshi Nest Wiki

feature: migrate docs

move from Wiki to per-component MD files + master (Readme?)

so that any new PRS will include DOC, + Test + Component

and ideally no need to maintain Wiki manually

Improvements: Hazard Curves Clarity

  • y-axis on hazard curve should read "Annual Probability of Exceedance"
  • PoE legend on hazard curve should read "PoE X% in 50 years"
  • PoE can be any value

Config/re-setup documentation react app

The documentation has been moved to the Wiki page of this github repo, and the react app that is within this repo should be renamed as "playground" because it will be used for testing/playground purpose only. Some config items in rollup.config.js will need to be changed

done when:

  • Documentation react app is replaced by another working react app called playground
  • When yarn i-all is ran, the node_modules for playground directory is updated
  • When yarn build or yarn build-watch is ran, toshi-nest source code is build into /playground/src/component-lib
  • files in component-lib should be ignored by git and not present in the codebase

Koraraa Feature: Clickable hazard map

Users want to be able to click on a colored tile of the hazard map and get the value of hazard (acceleration) at that location. Text should be "{value} (g)"

Nest Feature: controls for charts

We want a widget on the chart that opens a box that can contain chart controls. Those controls will be customized by use to allow the user some control over chart behavior and appearance (e.g. switch between linear and log scale). The widget would be a faint gear icon in the upper right corner of the chart that when clicked opens up the chart controls

Nest Feature: Disagg Bar Chart

Users want to be able to view the contribution to hazard (a disaggregation) as a function of distance or magnitude. To do that we need a bar chart plot for the disaggregations.

Types

The chart will come in two flavors:

  • distance on x axis
  • magnitude on x axis

Controls

The chart will have the following controls

  • tectonic region check boxes (3 across the top)
  • a slider for magnitude range or distance range across the bottom
  • The slider control has a lower and upper value. The range between is colored (blue)

Initial state

  • The slide should start with the full range (lower at lowest setting, upper at highest setting)

What to plot

The bar chart will plot:

  • the full range in white
  • the range selected by the slider in front of the white bars in (blue)

The API will supply values for the full range and the filtered range (x values and y values for bar chart). So there are 3 arrays/lists

  • x
  • y_full
  • y_filtered

The API will supply values depending on:

  • the slider selection (y_filtered will change)
  • the tectonic region check boxes (y_full and y_filtered will change)

Responsive behavior

The chart will be responsive. No "submit" button. When the user changes the check boxes or slider, the API query is made and new arrays plotted

distance bar
magnitude bar

Deck.gl preview

take a opensha geojson and make it a) work b) fancy.

  • revolve 3d
  • popup/hover fault info

Kororaa Epic: dissagregation enhancements

We want to be able to plot dissagregation data as 2D and/or 3D bar charts. There are 4 possible independent variables that a dissag chart could be plotted on:

  • TRT (tectonic region type)
  • magnitude
  • distance
  • epsilon

We want to user to be able to choose up to 2 variables for the spatial (x-y) axes of the plot and up to 1 for the color.

  • If the user chooses 1 variable for the spatial axis the result is a 2D bar chart:
    image
  • If the user chooses 2 variables for the spatial axes, the result is a 3D bar chart:
    image

Assume the application API will handle serving the correct data when axes are chosen by the user (i.e., collapsing of the data along certain axes must happen to create the correct data, this will be handled by either Kororaa or the API, it is not in scope for this ticket).

The color of the bars is plotted according to the color axis chosen by the user. The API will supply them in the order to be plotted and their contribution to the height of the bar, the component only needs to render them e.g.
image

Nest Feature: hazard curve uncertainty - curve style customization

For the uncertainty hazard curve we want to be able to specify curve and area fill style.

Properties of curve are:

  • name
  • stroke size (default ?)
  • stroke opacity (default ?)
  • stroke color
  • stroke style (list of possible styles to be provided by @0qy (default ?)
  • data (x,y)

For Area:

  • name
  • color
  • opacity

Feature: Solvis Leaflet

Add solvis leaflet component to nest;
done when:

  • leaflet component added to repo
  • component has playground page and renders correctly
  • component has good test coverage
  • documentation added

Nest Feature: map colorbar info text

Users want to know what hazard data on the map is being displayed without the drawer open and need information about the units of the scale.

  • text above the colorbar: Vs30 = {vs30}m/s, {spectral period} {poe}% in 50 years
  • text below the colorbar: "Acceleration (g)"
  • add background so underlying maps don't matter
  • add api setting for z layer (we don't want this being the topmost layer)

Feature: MultiSelect Component

Migrate the MultiSelect plot component from toshi

done when:

  • Component added
  • Documentation added to Toshi Nest Wiki including code demo, image of usage, and props table

Nest Feature: drawer for leaflet map

We want a drawer component that can be used to control particular layers on a map (e.g. the seismic hazard or rupture set). Done when

  • the drawer can be incorporated with a map
  • it can be expanded to make controls available or collapsed to view more of the map
  • it is configurable with entry boxes and drop down menus used to control a map layer

example of a drawer feature from google maps is attached. Example of a drawer feature as used in Kororaa can be found here https://www.figma.com/file/ggot2VddYVPGIF3u9TNl17/Korora?node-id=0%3A1

image

FIX: zoomed plots become comical

Q: is there any way to make plots more legible when user has zoomed in a long way....

Matt provided this example from TUI with zoom 240...
image

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.