How is the Database Structured?#

The goal of the database is to hold as much of the SnowEx data in one place and make it easier to do research with. With that in mind follow the steps below to see how the the data base is structured.

Where do datasets live (i.e. tables)?#

Data in the database lives in 1 of 4 places.

Structure of the snowex db

Fig. 1 Layout of the database tables#

The 4th table is a table detailing the site information. Lots and lots of metadata for which the API has not been written yet.

So how does this look in python?

from snowexsql.api import PointMeasurements, LayerMeasurements, RasterMeasurements

How are tables structured?#

Each table consists of rows and columns. Below are the available columns!

# Import the class reflecting the points table in the db
from snowexsql.api import PointMeasurements as measurements

# Grab one measurement to see what attributes are available
df = measurements.from_filter(type="depth", limit=1)

# Print out the results nicely
print("These are the available columns in the table:\n \n* {}\n".format('\n* '.join(df.columns)))
These are the available columns in the table:
 
* version_number
* equipment
* value
* latitude
* longitude
* northing
* easting
* elevation
* utm_zone
* geom
* time
* site_id
* site_name
* date
* time_created
* time_updated
* id
* doi
* date_accessed
* instrument
* type
* units
* observers

Try this: Using what we just did, but swap out PointMeasurements for LayerMeasurements.

Question: Did you collect any data? What is it? What table do you think it would go in?

For more detail, checkout the readthedocs page on database structure to see how data gets categorized.

Bonus Step: Learning to help yourself#

snowexsql has a host of resources for you to help your self. First when you are looking for something be sure to check the snowexsql’s docs. There you will find notes on the database structure. datasets, and of course our new API!

Database Usage/Examples#

Database Building/Notes#

Recap#

You just explored the database structure and discussed how they differ.

You should know:

  • Which table a dataset might live in

  • What columns you can work with (or how to get the available columns)

  • Some resources to begin helping yourself.

If you don’t feel comfortable with these, you are probably not alone, let’s discuss it!