Skip to content

Commit

Permalink
Refactor of entire codebase (#257)
Browse files Browse the repository at this point in the history
* 1st Refactor: move core classes to core dir

* Add empty Select class and expose top-level classes

* Fix typo in __all__

* Rename old core file

* Rename core to core_old

* Change how constants is loaded

* Change names in constants

* Fiddle with empty Select class def

* Fix local data file pathing

* Move read_csv_file to utils

* Fix path read_csv_file

* Try adding Boundaries class call to DataInterface

* Add missing import

* Add DataInterface init to Select class

* Move utils to util and add DataSelector class

* Rework read_csv func

* Rework helper func

* Move catalog_convert to core

* Add _get_variable_options_df func

* Add _get_variable_options_df func

* Add _get_var_ids func

* Finalize DataSelector class

* Try to fix multiple input error

* Try to fix multiple input error

* Try to fix multiple input error

* Try to fix multiple input error

* Try to fix multiple input error

* Try loading DataInterface on package load

* Abandon loading class on package load and make DataInterface singleton class

* Make needed change for class rename

* Load DataInterface on DataParameters init

* Fix subroutine call

* Fix subroutine call

* Try to fix singleton stuff

* Extend DataInterface class

* fix typo

* Add DataParametersWithPanes class and fix subroutines

* fix bad ref

* fix sub routine calls

* Move panel stuff to select

* Display select panel

* Display select panel fix

* Display select panel auto display

* Display select panel auto display try 2

* Display select panel auto display try 3

* Give up on auto showing select panel

* Move select to ui submodule

* Hook data retrieve to DataParameters

* Try to run retrieve from Select

* Try to run retrieve from Select

* Expose load at package level

* Renamed data_loaders -> data_loader, data_view -> data_viewer and moved to core

* Add view to top level methods

* Fix import naming

* Attempt to reorg export functions

* Expose ExportFormat as top level class

* Fix circular ref

* add show method to ExportFormat

* Change export menu to method

* Add dataset_export top-level method

* Fix circular import again

* Try to fix circ. ref

* Get right attr for export format

* Rework FileTypeSelector

* black format

* Fix export file type ui

* Fiddle with export ui

* More fiddling

* more fiddling with export

* Removed repeated code

* Set watch false

* Added Export class on top level

* Fix for missing param

* Redo export panel

* wire dataset_export method

* Fix data_export

* Fix export

* move colormap files to constants

* Move cluster to util

* Start reworking Explore

* Code changes needed to add Warming Levels to Explore

* change read_ae_colormap to callable func

* expose compute_vmin_vmax func

* fixes needed for explore

* change warming_levels to explore_warming

* remove last pkg_resources

* change how Explore methods are called

* Use DataParametersWithPanes in warming

* Try to fix panel not displaying

* Fix wrong ref

* Debug non-showing warming panel

* Debug non-showing warming panel 2

* Try calling warming differently

* Test basic return

* Test basic return

* Add test of explore

* Fix test

* basic test

* Restore explore code after false error

* Rewire thresholds panel

* Rewire explore AMY

* Fix threshold issues

* Fix bad import

* Fix bad import ref

* Changes for amy panel

* Fix bad refs in panel code

* Try calling AMY as class

* Use classes for Explore

* Fix class

* Clean up

* Add retrieve convenience

* Rework TimeSeries

* Clean up data_loader

* Remove bad retrieve refs

* Delete unused old selectors

* Move derive_vars

* Move remaining files

* Try to fix first test

* Fix imports

* Fixes for tests

* Fix for tests erroring

* Black format

* Rename constants -> paths

* make funcs public

* Move boundaries catalog open to data_interface

* Fix replace mess up

* Change data_loader -> data_load

* rename data_viewer -> data_view

* Bump climakitae version to 0.1.0! update README.

* fixes for uncertain utils

* Fix missing arg

* Fix Thresholds optional param

* Remove unused packages

* Fix version call

* Rework testing workflow to use Linux only

* Rename function calls and consolidate paths

* Black format

* Make Select subclass of DataParametersWithPanes

* Make explore classes subclasses for their Parameters classes

* Bug in utils...name wrong

* Black formatting

* Add properties to DataInterface to prevent setting properties outside of class init

* Start to reformat docs to reflect changed syntax

* Work on docs

* Merge fix

* Fix indices test

* Black format

* Attempt to rewire Explore

* Tweak Explore.explore

* FIx time scale issue

* Test explore

* wire Explore similar to old ck

* Black format

* Try moving Explore to init

* Reorganize Explore

* Remove indices dir and move indices to tools

* Remove catalog_convert and move funcs to data_load

* Remove unused metadata_update

* Rename timeseriestools -> timeseries

* Rename uncertain_utils -> uncertainty

* Rename derive_variables -> derived_variables

* Rename tests/data_loaders -> data_load

* Black format

* Update Documentation

* Black format

* Ref fixes

* Black format

* Fix package call

* Updated sphinx documentation

* Black format

* Add forgotten retrieve methods

* Change how explore works

* Add a comment

* Fixes for explore classes

* Fixes of classes

* Export Dataset to CSV and more

See #271 for details

* Black format

* Remove pane from view as it messes up mixing of matplotlib overlays

* Black format

* Remove DataInteface and Explore from __init__

* Remove Explore class

* Remove refs to Explore

* Black format

* Remove references to app.

* Fix missing option in threshold

* Remove TS and Export from top level classes

* Move timeseries and thresholds to explore

* Fix move

* Fix test import

* Rewire export as top level method

* Fix documentation

* Move Select logic to data_interface and remove ui module

* Rewire Select

* Reorder export method and rename vars and give defaults

* Black format

* edits to readthedocs data page (#274)

* Add contribution guidelines to readthedocs (#272)

* pencil icon

* Update README.md

Added excerpt about finding free SVG vectors

* Adding contribution guidelines section to docs

* add title

---------

Co-authored-by: Calvin Chen <33679281+claalmve@users.noreply.github.com>
Co-authored-by: Calvin Chen <calvinchen@Calvins-MacBook-Pro.local>

* flexible coord drop fn dependent on data source for cdd/hdd (#273)

* flexible coord drop fn dependent on data source

* flexible drop fn for hdd/cdd merge step

* hdh/cdh flexible

* run black

* incorporate refactor code

* Attempt to fix amy panel issue

* Remove GeoTiff option from export

* Update export readthedocs documentation (#277)

* Update export section of `data.rst`

* Format previous updates

* More formatting

* Update `export` function docstring

* Format code with black

---------

Co-authored-by: Tianchi-Liu <liutc@berkeley.edu>
Co-authored-by: Grace Di Cecco <31256832+gdicecco@users.noreply.github.com>
Co-authored-by: Nicole Keeney <nicolejkeeney@gmail.com>
Co-authored-by: Calvin Chen <33679281+claalmve@users.noreply.github.com>
Co-authored-by: Calvin Chen <calvinchen@Calvins-MacBook-Pro.local>
Co-authored-by: Victoria Ford <fordvecellio@gmail.com>
Co-authored-by: Tianchi-Liu <56141689+Tianchi-Liu@users.noreply.github.com>
  • Loading branch information
8 people authored Aug 25, 2023
1 parent 132a568 commit 77ebfe4
Show file tree
Hide file tree
Showing 54 changed files with 2,471 additions and 2,349 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,8 @@ jobs:
- uses: actions/checkout@v3
- uses: psf/black@stable
build:
strategy:
matrix:
include:
- os: ubuntu-latest
label: linux-64
lock-file: conda-linux-64.lock

- os: macos-latest
label: osx-64
lock-file: conda-osx-64.lock

- os: windows-latest
label: win-64
lock-file: conda-win-64.lock
name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
name: linux-64
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
Expand All @@ -41,13 +27,15 @@ jobs:
with:
auto-activate-base: false
activate-environment: climakitae-tests
environment-file: ${{ matrix.lock-file }}
environment-file: conda-linux-64.lock
use-only-tar-bz2: true
- name: Output conda info
run: conda info
- name: Install xclim
- name: Install pip packages
run: pip install dask-gateway==2023.1.1 dask-geopandas==0.3.1 xclim==0.42.0
- name: Install climakitae
run: pip install .
- name: Output conda list
run: conda list
- name: Test with pytest
run: pytest --no-header -vv
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ Basic Usage
-----------

```
import climakitae as ck # Import the package
app = ck.Application() # Initialize Application object
app.select() # Pull up selections GUI to make data settings
data = app.retrieve() # Retrieve the data from the AWS catalog
data = app.load(data) # Read the data into memory
app.view(data) # Generate a basic visualization of the data
import climakitae as ck # Import the package
sel = ck.Select().show() # Pull up selections GUI to make data settings
data = sel.retrieve() # Retrieve the data from the AWS catalog
data = ck.load(data) # Read the data into memory
ck.view(data) # Generate a basic visualization of the data
from climakitae.explore import warming_levels # Import warming levels code
wl = warming_levels().show() # Explore Warming Levels GUI
```

Links
Expand Down
16 changes: 15 additions & 1 deletion climakitae/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from climakitae.core.data_interface import Select
from climakitae.core.data_load import load
from climakitae.core.data_view import view
from climakitae.core.data_export import export

try:
from importlib.metadata import version as _version
except ImportError:
Expand All @@ -11,4 +16,13 @@
# Disable minimum version checks on downstream libraries.
__version__ = "999"

from .core import Application
__all__ = (
# Classes
"Select",
# Methods
"load",
"view",
"export",
# Constants
"__version__",
)
51 changes: 0 additions & 51 deletions climakitae/catalog_convert.py

This file was deleted.

Loading

0 comments on commit 77ebfe4

Please sign in to comment.