Matthew Long
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Integral `Integral` aim to provide a framework for provenance tracking, automation and extensibility in the context of analysis using `xarray.Dataset's`. ## Objectives Here we attempt to clearly articulate the problems we are trying to solve. ### Enable common interface to different types of Datasets It is often not possible or computationally efficient to merge data into a single Dataset. For instance, - collections of models on different grids; - collections of variables from different numerical experiments; - combinations of gridded observations and models. Yet as a matter of convience and to enable automation of workflows, it is desirable to have a clean interface to collections of Datasets. ### Provide automated caching of intermediate results While Dask enables powerful parallelism and thus rapid execution of large computation, in practice (at least in my experience) it is often not possible to reduce execution time below thresholds required to sustain interactive analysis. Caching the results of expensive computations is an easy way to dramatically enhance interactive analysis. Moreover, in the context of a modular workflow, where multiple processes may want to use the results of the same computation, caching can dramatically reduce total computational cost. Finally, cached dimensionally-reduced data products have the potential to enable interactive visualization tools. Building caching in as an intrinsic component of the workflow can yield a seamless end-to-end framework, wherein computation is done only if necessary, relying on cached products when they are available, but preserving the entire provenance chain *in situ*. ### Formalize extensibility Developing codes that handle Big Data in the context of complex workflows is challenging. We require a framework that is inherently *scalable* in the sense that codes can be rapidly developed and tested on small problems---and then deployed at scale on large ones. Development and testing is often best done outside the context of comprehensive frameworks, thus we want to enable development outside these frameworks, and specific means of plugging-in. ### Provide an API for data access An API wraps messy details behind a standardized interface. Using APIs for data access has several advantages. - Data access based on hard-coded paths is not portable; - The *type* of data being read can be part of the API, triggering appropriate access to metadata or overloaded methods; - Desired product sometimes involves rote computation - e.g., [`pop_tools.get_grid(...)`](https://pop-tools.readthedocs.io/en/latest/examples/get-model-grid.html) reads `CESM INPUTDATA` files via web protocol; - Access details are messy: - Arbitrary number of files, - Standardizations steps to be applied en route; - An API can be parameterized (i.e., it can accept arguments, enabling control and automation). ### Provide infrastructure to automate interoperability, dataset-specific settings and preferences Standards and conventions can help make data interoperable, but in reality, many of our datasets have peculiarities that require special treatment. The desired units of a particular quantity, for instance, may need standardization. ## Design ### Objects There are two primary objects: `Component` and `Collection`. A `Component` is to a `Collection` as an `xarray.DataArray` is to an `xarray.Dataset`. The `Collection` object provides a powerful means of loading multiple `Components` and operating on them en masse, acknowledging that they may require different handling. Here is some pseudo-code defining the `Component`. ```python= class Component(object): """A container for an `xarray.Dataset` that facilitates: - loading data via intake-esm API - applying methods with automated caching - attaching dataset-specific methods for particular computation """ def __init__(self, **kwargs): """Instantiate an instance of this object: 1. compose object from intake catalog and query 2. determine the dataset type? 3. apply query 4. set provence-tracking attributes for utilized data assets """ self._assets = ... # apply query self._ds = None @property def ds(self): """lazy but persistent access to the xarray.Dataset for this Component. """ if self._ds is None: # open dataset from assets # apply dataset-specific "data cleaning" operations # self._ds = ds return self._ds @property def _grid(self): """return an xarray.Dataset of the asset's grid""" # use attributes of "self" to determine how to get the grid data # for example: self._grid = pop_tools.get_grid(self.grid_name) return self._grid def _persist_ds( compute_func, dataset_name, ): """call operator within a wrapper to persist a dataset""" # define the wrapper function def compute_wrapper(self, **kwargs): # get variables meant for local control persist = kwargs.pop('persist', True) clobber = kwargs.pop('clobber', False) if persist: # generate xpersist partial: xp_persist_ds return xp_persist_ds(compute_func)(self.ds, **kwargs) else: return compute_func(self.ds, **kwargs) return compute_wrapper ``` ### Inject methods We want to do something like `xarray` does for datasets (see [here](https://github.com/pydata/xarray/blob/master/xarray/core/ops.py)). ```python= def inject_methods(cls): for f in INJECTION_LIST: # provenance_key = query "method registry" func = cls._persist_ds(f, provenance_key) func.__name__ = name func.__doc__ = ... setattr(cls, name, func) ``` This will be called following the declaration of `Component` etc. ### Integral projects The `integral` package will be very general, providing key functionality for core tasks and supporting anything available in `xarray`, but will rely on extensions developed elsewhere to support application-specific implementations. For example, the CESM project may have a `integral-cesm` repository that implements specific methods and configurations relevant to CESM components and observational datasets used to validate them. ## Example applications Here is a an example of what the user API might look like. Imagine someone wants to create a plot showing the globally-integrated air-sea CO2 flux (`FG_CO2`) timeseries at annual resolution. ```python= # load a collection for list of query values (experiments, variables) dsets = integral.Collection( experiment=experiments, variable=variables, ) # compute timeseries dsets_ts = dsets.timeseries( normalize=False, freq='ann', persist=True ) # make a plot dsets_ts['historical', 'FG_CO2'].plot() ```

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully