terra_ui_components 0.0.32__py3-none-any.whl → 0.0.121__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of terra_ui_components might be problematic. Click here for more details.

Files changed (27) hide show
  1. terra_ui_components/__init__.py +10 -2
  2. terra_ui_components/accordion/__init__.py +3 -0
  3. terra_ui_components/accordion/accordion.py +50 -0
  4. terra_ui_components/base.py +4 -4
  5. terra_ui_components/data_access/__init__.py +3 -0
  6. terra_ui_components/data_access/data_access.py +50 -0
  7. terra_ui_components/data_rods/__init__.py +3 -0
  8. terra_ui_components/data_rods/data_rods.py +50 -0
  9. terra_ui_components/data_subsetter/__init__.py +3 -0
  10. terra_ui_components/data_subsetter/data_subsetter.py +84 -0
  11. terra_ui_components/data_subsetter_history/__init__.py +3 -0
  12. terra_ui_components/data_subsetter_history/data_subsetter_history.py +50 -0
  13. terra_ui_components/input/__init__.py +3 -0
  14. terra_ui_components/input/input.py +50 -0
  15. terra_ui_components/login/login.py +28 -18
  16. terra_ui_components/plot_toolbar/__init__.py +3 -0
  17. terra_ui_components/plot_toolbar/plot_toolbar.py +50 -0
  18. terra_ui_components/slider/__init__.py +3 -0
  19. terra_ui_components/slider/slider.py +50 -0
  20. terra_ui_components/time_average_map/__init__.py +3 -0
  21. terra_ui_components/time_average_map/time_average_map.py +135 -0
  22. terra_ui_components/time_series/time_series.py +7 -23
  23. {terra_ui_components-0.0.32.dist-info → terra_ui_components-0.0.121.dist-info}/METADATA +3 -3
  24. terra_ui_components-0.0.121.dist-info/RECORD +39 -0
  25. terra_ui_components-0.0.32.dist-info/RECORD +0 -21
  26. {terra_ui_components-0.0.32.dist-info → terra_ui_components-0.0.121.dist-info}/WHEEL +0 -0
  27. {terra_ui_components-0.0.32.dist-info → terra_ui_components-0.0.121.dist-info}/licenses/LICENSE.md +0 -0
@@ -1,8 +1,16 @@
1
1
  from .base import TerraBaseWidget
2
2
  from .date_range_slider import TerraDateRangeSlider
3
- from .giovanni_search import TerraGiovanniSearch
4
3
  from .time_series import TerraTimeSeries
5
4
  from .login import TerraLogin
6
5
  from .dialog import TerraDialog
7
6
  from .date_picker import TerraDatePicker
8
- __all__ = ["TerraBaseWidget", "TerraDateRangeSlider", "TerraGiovanniSearch", "TerraTimeSeries", "TerraLogin", "TerraDialog", "TerraDatePicker"]
7
+ from .data_rods import TerraDataRods
8
+ from .accordion import TerraAccordion
9
+ from .data_subsetter import TerraDataSubsetter
10
+ from .data_subsetter_history import TerraDataSubsetterHistory
11
+ from .time_average_map import TerraTimeAverageMap
12
+ from .plot_toolbar import TerraPlotToolbar
13
+ from .data_access import TerraDataAccess
14
+ from .slider import TerraSlider
15
+ from .input import TerraInput
16
+ __all__ = ["TerraBaseWidget", "TerraDateRangeSlider", "TerraTimeSeries", "TerraLogin", "TerraDialog", "TerraDatePicker", "TerraDataRods", "TerraAccordion", "TerraDataSubsetter", "TerraDataSubsetterHistory", "TerraTimeAverageMap", "TerraPlotToolbar", "TerraDataAccess", "TerraSlider", "TerraInput"]
@@ -0,0 +1,3 @@
1
+ from .accordion import TerraAccordion
2
+
3
+ __all__ = ["TerraAccordion"]
@@ -0,0 +1,50 @@
1
+ import importlib.metadata
2
+ import traitlets
3
+ from ..base import TerraBaseWidget
4
+
5
+ try:
6
+ __version__ = importlib.metadata.version("terra_accordion")
7
+ except importlib.metadata.PackageNotFoundError:
8
+ __version__ = "unknown"
9
+
10
+
11
+ class TerraAccordion(TerraBaseWidget):
12
+ _esm = TerraBaseWidget.get_autoloader() + """
13
+ function render({ model, el }) {
14
+ // create an instance of the component
15
+ let component = document.createElement('terra-accordion')
16
+
17
+ /**
18
+ * Set initial property values
19
+ * NOTE: In reality, we won't need to have the ability to set EVERY property in a Jupyter Notebook, feel free to remove the ones that don't make sense
20
+ *
21
+ * model.get() pulls from the Jupyter notebooks state. We'll use the state to set the initial value for each property
22
+ */
23
+ component.attr = model.get('attr')
24
+
25
+ /**
26
+ * add the component to the cell
27
+ * it should now be visible in the notebook!
28
+ */
29
+ el.appendChild(component)
30
+
31
+
32
+ /**
33
+ * Set up property change handlers
34
+ * This way if someone in the Jupyter Notebook changes the property externally, we reflect the change
35
+ * back to the component.
36
+ *
37
+ * If this isn't here, the component can't be changed after it's initial render
38
+ */
39
+ model.on('change:attr', () => {
40
+ component.attr = model.get('attr')
41
+ })
42
+ }
43
+
44
+ export default { render };
45
+ """
46
+
47
+ # Component properties
48
+ # While we have properties in the component, we also need to tell Python about them as well.
49
+ # Again, you don't technically need all these. If Jupyter Notebooks don't need access to them, you can remove them from here
50
+ attr = traitlets.Unicode('').tag(sync=True)
@@ -16,13 +16,13 @@ class TerraBaseWidget(anywidget.AnyWidget):
16
16
  return f"""
17
17
  const terraStyles = document.createElement('link')
18
18
  terraStyles.rel = 'stylesheet'
19
- terraStyles.href = 'https://cdn.jsdelivr.net/npm/@nasa-terra/components@0.0.32/cdn/themes/horizon.css'
20
- //terraStyles.href = "https://localhost:4000/dist/themes/horizon.css"
19
+ terraStyles.href = 'https://cdn.jsdelivr.net/npm/@nasa-terra/components@0.0.121/cdn/themes/horizon.css'
20
+ //terraStyles.href = "http://localhost:4000/dist/themes/horizon.css"
21
21
  document.head.appendChild(terraStyles)
22
22
 
23
23
  const terraAutoloader = document.createElement('script')
24
- terraAutoloader.src = "https://cdn.jsdelivr.net/npm/@nasa-terra/components@0.0.32/cdn/terra-ui-components-autoloader.js"
25
- //terraAutoloader.src = "https://localhost:4000/dist/terra-ui-components-autoloader.js"
24
+ terraAutoloader.src = "https://cdn.jsdelivr.net/npm/@nasa-terra/components@0.0.121/cdn/terra-ui-components-autoloader.js"
25
+ //terraAutoloader.src = "http://localhost:4000/dist/terra-ui-components-autoloader.js"
26
26
  terraAutoloader.type = 'module'
27
27
  document.head.appendChild(terraAutoloader)
28
28
  """
@@ -0,0 +1,3 @@
1
+ from .data_access import TerraDataAccess
2
+
3
+ __all__ = ["TerraDataAccess"]
@@ -0,0 +1,50 @@
1
+ import importlib.metadata
2
+ import traitlets
3
+ from ..base import TerraBaseWidget
4
+
5
+ try:
6
+ __version__ = importlib.metadata.version("terra_data_access")
7
+ except importlib.metadata.PackageNotFoundError:
8
+ __version__ = "unknown"
9
+
10
+
11
+ class TerraDataAccess(TerraBaseWidget):
12
+ _esm = TerraBaseWidget.get_autoloader() + """
13
+ function render({ model, el }) {
14
+ // create an instance of the component
15
+ let component = document.createElement('terra-data-access')
16
+
17
+ /**
18
+ * Set initial property values
19
+ * NOTE: In reality, we won't need to have the ability to set EVERY property in a Jupyter Notebook, feel free to remove the ones that don't make sense
20
+ *
21
+ * model.get() pulls from the Jupyter notebooks state. We'll use the state to set the initial value for each property
22
+ */
23
+ component.attr = model.get('attr')
24
+
25
+ /**
26
+ * add the component to the cell
27
+ * it should now be visible in the notebook!
28
+ */
29
+ el.appendChild(component)
30
+
31
+
32
+ /**
33
+ * Set up property change handlers
34
+ * This way if someone in the Jupyter Notebook changes the property externally, we reflect the change
35
+ * back to the component.
36
+ *
37
+ * If this isn't here, the component can't be changed after it's initial render
38
+ */
39
+ model.on('change:attr', () => {
40
+ component.attr = model.get('attr')
41
+ })
42
+ }
43
+
44
+ export default { render };
45
+ """
46
+
47
+ # Component properties
48
+ # While we have properties in the component, we also need to tell Python about them as well.
49
+ # Again, you don't technically need all these. If Jupyter Notebooks don't need access to them, you can remove them from here
50
+ attr = traitlets.Unicode('').tag(sync=True)
@@ -0,0 +1,3 @@
1
+ from .data_rods import TerraDataRods
2
+
3
+ __all__ = ["TerraDataRods"]
@@ -0,0 +1,50 @@
1
+ import importlib.metadata
2
+ import traitlets
3
+ from ..base import TerraBaseWidget
4
+
5
+ try:
6
+ __version__ = importlib.metadata.version("terra_data_rods")
7
+ except importlib.metadata.PackageNotFoundError:
8
+ __version__ = "unknown"
9
+
10
+
11
+ class TerraDataRods(TerraBaseWidget):
12
+ _esm = TerraBaseWidget.get_autoloader() + """
13
+ function render({ model, el }) {
14
+ // create an instance of the component
15
+ let component = document.createElement('terra-data-rods')
16
+
17
+ /**
18
+ * Set initial property values
19
+ * NOTE: In reality, we won't need to have the ability to set EVERY property in a Jupyter Notebook, feel free to remove the ones that don't make sense
20
+ *
21
+ * model.get() pulls from the Jupyter notebooks state. We'll use the state to set the initial value for each property
22
+ */
23
+ component.attr = model.get('attr')
24
+
25
+ /**
26
+ * add the component to the cell
27
+ * it should now be visible in the notebook!
28
+ */
29
+ el.appendChild(component)
30
+
31
+
32
+ /**
33
+ * Set up property change handlers
34
+ * This way if someone in the Jupyter Notebook changes the property externally, we reflect the change
35
+ * back to the component.
36
+ *
37
+ * If this isn't here, the component can't be changed after it's initial render
38
+ */
39
+ model.on('change:attr', () => {
40
+ component.attr = model.get('attr')
41
+ })
42
+ }
43
+
44
+ export default { render };
45
+ """
46
+
47
+ # Component properties
48
+ # While we have properties in the component, we also need to tell Python about them as well.
49
+ # Again, you don't technically need all these. If Jupyter Notebooks don't need access to them, you can remove them from here
50
+ attr = traitlets.Unicode('').tag(sync=True)
@@ -0,0 +1,3 @@
1
+ from .data_subsetter import TerraDataSubsetter
2
+
3
+ __all__ = ["TerraDataSubsetter"]
@@ -0,0 +1,84 @@
1
+ import importlib.metadata
2
+ import traitlets
3
+ from ..base import TerraBaseWidget
4
+
5
+ try:
6
+ __version__ = importlib.metadata.version("terra_data_subsetter")
7
+ except importlib.metadata.PackageNotFoundError:
8
+ __version__ = "unknown"
9
+
10
+
11
+ class TerraDataSubsetter(TerraBaseWidget):
12
+ _esm = TerraBaseWidget.get_autoloader() + """
13
+ function render({ model, el }) {
14
+ // create an instance of the component
15
+ let component = document.createElement('terra-data-subsetter')
16
+
17
+ /**
18
+ * Set initial property values
19
+ * NOTE: In reality, we won't need to have the ability to set EVERY property in a Jupyter Notebook, feel free to remove the ones that don't make sense
20
+ *
21
+ * model.get() pulls from the Jupyter notebooks state. We'll use the state to set the initial value for each property
22
+ */
23
+ component.collectionEntryId = model.get('collectionEntryId')
24
+ component.showCollectionSearch = model.get('showCollectionSearch')
25
+ component.jobId = model.get('jobId')
26
+ component.bearerToken = model.get('bearerToken')
27
+
28
+ /**
29
+ * add the component to the cell
30
+ * it should now be visible in the notebook!
31
+ */
32
+ el.appendChild(component)
33
+
34
+
35
+ /**
36
+ * Set up property change handlers
37
+ * This way if someone in the Jupyter Notebook changes the property externally, we reflect the change
38
+ * back to the component.
39
+ *
40
+ * If this isn't here, the component can't be changed after it's initial render
41
+ */
42
+ model.on('change:collectionEntryId', () => {
43
+ component.collectionEntryId = model.get('collectionEntryId')
44
+ })
45
+ model.on('change:showCollectionSearch', () => {
46
+ component.showCollectionSearch = model.get('showCollectionSearch')
47
+ })
48
+ model.on('change:jobId', () => {
49
+ component.jobId = model.get('jobId')
50
+ })
51
+ model.on('change:bearerToken', () => {
52
+ component.bearerToken = model.get('bearerToken')
53
+ })
54
+
55
+ /**
56
+ * Add event listeners.
57
+ * These are used to communicate back to the Jupyter notebook
58
+ */
59
+ component.addEventListener('terra-subset-job-complete', (e) => {
60
+ // hide the loading overlay, if it exists
61
+ const loadingOverlay = document.getElementById('jupyterlite-loading-overlay')
62
+
63
+ if (loadingOverlay) {
64
+ loadingOverlay.remove()
65
+ }
66
+
67
+ console.log('caught the event!! ', e)
68
+
69
+ model.set('job', e.detail)
70
+ model.save_changes()
71
+ })
72
+ }
73
+
74
+ export default { render };
75
+ """
76
+
77
+ # Component properties
78
+ # While we have properties in the component, we also need to tell Python about them as well.
79
+ # Again, you don't technically need all these. If Jupyter Notebooks don't need access to them, you can remove them from here
80
+ collectionEntryId = traitlets.Unicode('').tag(sync=True)
81
+ showCollectionSearch = traitlets.Unicode('').tag(sync=True)
82
+ jobId = traitlets.Unicode('').tag(sync=True)
83
+ bearerToken = traitlets.Unicode('').tag(sync=True)
84
+ job = traitlets.Any(default_value={}).tag(sync=True)
@@ -0,0 +1,3 @@
1
+ from .data_subsetter_history import TerraDataSubsetterHistory
2
+
3
+ __all__ = ["TerraDataSubsetterHistory"]
@@ -0,0 +1,50 @@
1
+ import importlib.metadata
2
+ import traitlets
3
+ from ..base import TerraBaseWidget
4
+
5
+ try:
6
+ __version__ = importlib.metadata.version("terra_data_subsetter_history")
7
+ except importlib.metadata.PackageNotFoundError:
8
+ __version__ = "unknown"
9
+
10
+
11
+ class TerraDataSubsetterHistory(TerraBaseWidget):
12
+ _esm = TerraBaseWidget.get_autoloader() + """
13
+ function render({ model, el }) {
14
+ // create an instance of the component
15
+ let component = document.createElement('terra-data-subsetter-history')
16
+
17
+ /**
18
+ * Set initial property values
19
+ * NOTE: In reality, we won't need to have the ability to set EVERY property in a Jupyter Notebook, feel free to remove the ones that don't make sense
20
+ *
21
+ * model.get() pulls from the Jupyter notebooks state. We'll use the state to set the initial value for each property
22
+ */
23
+ component.attr = model.get('attr')
24
+
25
+ /**
26
+ * add the component to the cell
27
+ * it should now be visible in the notebook!
28
+ */
29
+ el.appendChild(component)
30
+
31
+
32
+ /**
33
+ * Set up property change handlers
34
+ * This way if someone in the Jupyter Notebook changes the property externally, we reflect the change
35
+ * back to the component.
36
+ *
37
+ * If this isn't here, the component can't be changed after it's initial render
38
+ */
39
+ model.on('change:attr', () => {
40
+ component.attr = model.get('attr')
41
+ })
42
+ }
43
+
44
+ export default { render };
45
+ """
46
+
47
+ # Component properties
48
+ # While we have properties in the component, we also need to tell Python about them as well.
49
+ # Again, you don't technically need all these. If Jupyter Notebooks don't need access to them, you can remove them from here
50
+ attr = traitlets.Unicode('').tag(sync=True)
@@ -0,0 +1,3 @@
1
+ from .input import TerraInput
2
+
3
+ __all__ = ["TerraInput"]
@@ -0,0 +1,50 @@
1
+ import importlib.metadata
2
+ import traitlets
3
+ from ..base import TerraBaseWidget
4
+
5
+ try:
6
+ __version__ = importlib.metadata.version("terra_input")
7
+ except importlib.metadata.PackageNotFoundError:
8
+ __version__ = "unknown"
9
+
10
+
11
+ class TerraInput(TerraBaseWidget):
12
+ _esm = TerraBaseWidget.get_autoloader() + """
13
+ function render({ model, el }) {
14
+ // create an instance of the component
15
+ let component = document.createElement('terra-input')
16
+
17
+ /**
18
+ * Set initial property values
19
+ * NOTE: In reality, we won't need to have the ability to set EVERY property in a Jupyter Notebook, feel free to remove the ones that don't make sense
20
+ *
21
+ * model.get() pulls from the Jupyter notebooks state. We'll use the state to set the initial value for each property
22
+ */
23
+ component.attr = model.get('attr')
24
+
25
+ /**
26
+ * add the component to the cell
27
+ * it should now be visible in the notebook!
28
+ */
29
+ el.appendChild(component)
30
+
31
+
32
+ /**
33
+ * Set up property change handlers
34
+ * This way if someone in the Jupyter Notebook changes the property externally, we reflect the change
35
+ * back to the component.
36
+ *
37
+ * If this isn't here, the component can't be changed after it's initial render
38
+ */
39
+ model.on('change:attr', () => {
40
+ component.attr = model.get('attr')
41
+ })
42
+ }
43
+
44
+ export default { render };
45
+ """
46
+
47
+ # Component properties
48
+ # While we have properties in the component, we also need to tell Python about them as well.
49
+ # Again, you don't technically need all these. If Jupyter Notebooks don't need access to them, you can remove them from here
50
+ attr = traitlets.Unicode('').tag(sync=True)
@@ -1,4 +1,5 @@
1
1
  import importlib.metadata
2
+ import traitlets
2
3
  from ..base import TerraBaseWidget
3
4
 
4
5
  try:
@@ -8,20 +9,21 @@ except importlib.metadata.PackageNotFoundError:
8
9
 
9
10
 
10
11
  class TerraLogin(TerraBaseWidget):
11
- _esm = (
12
- TerraBaseWidget.get_autoloader()
13
- + """
12
+ _esm = TerraBaseWidget.get_autoloader() + """
14
13
  function render({ model, el }) {
15
14
  // create an instance of the component
16
15
  let component = document.createElement('terra-login')
17
-
16
+
18
17
  /**
19
18
  * Set initial property values
20
19
  * NOTE: In reality, we won't need to have the ability to set EVERY property in a Jupyter Notebook, feel free to remove the ones that don't make sense
21
20
  *
22
21
  * model.get() pulls from the Jupyter notebooks state. We'll use the state to set the initial value for each property
23
22
  */
24
- component.attr = model.get('attr')
23
+ component.buttonLabel = model.get('buttonLabel')
24
+ component.loggedInMessage = model.get('loggedInMessage')
25
+ component.loggedOutMessage = model.get('loggedOutMessage')
26
+ component.loadingMessage = model.get('loadingMessage')
25
27
 
26
28
  /**
27
29
  * add the component to the cell
@@ -34,24 +36,32 @@ class TerraLogin(TerraBaseWidget):
34
36
  * Set up property change handlers
35
37
  * This way if someone in the Jupyter Notebook changes the property externally, we reflect the change
36
38
  * back to the component.
37
- *
39
+ *
38
40
  * If this isn't here, the component can't be changed after it's initial render
39
41
  */
40
- model.on('change:attr', () => {
41
- component.attr = model.get('attr')
42
+ model.on('change:buttonLabel', () => {
43
+ component.buttonLabel = model.get('buttonLabel')
42
44
  })
43
-
44
- /**
45
- * Add event listeners.
46
- * These are used to communicate back to the Jupyter notebook
47
- */
48
- component.addEventListener('terra-login', (e) => {
49
- // Placeholder for event handling, you'll need to provide your own functionality here
50
- model.set('terra-login_triggered', true)
51
- model.save_changes()
45
+ model.on('change:loggedInMessage', () => {
46
+ component.loggedInMessage = model.get('loggedInMessage')
47
+ })
48
+ model.on('change:loggedOutMessage', () => {
49
+ component.loggedOutMessage = model.get('loggedOutMessage')
50
+ })
51
+ model.on('change:loadingMessage', () => {
52
+ component.loadingMessage = model.get('loadingMessage')
52
53
  })
53
54
  }
54
55
 
55
56
  export default { render };
56
57
  """
57
- )
58
+
59
+ # Component properties
60
+ # While we have properties in the component, we also need to tell Python about them as well.
61
+ # Again, you don't technically need all these. If Jupyter Notebooks don't need access to them, you can remove them from here
62
+ buttonLabel = traitlets.Unicode('').tag(sync=True)
63
+ loggedInMessage = traitlets.Unicode(
64
+ 'You are logged in as {username}').tag(sync=True)
65
+ loggedOutMessage = traitlets.Unicode('').tag(sync=True)
66
+ loadingMessage = traitlets.Unicode(
67
+ 'Please wait while we check if you are logged in...').tag(sync=True)
@@ -0,0 +1,3 @@
1
+ from .plot_toolbar import TerraPlotToolbar
2
+
3
+ __all__ = ["TerraPlotToolbar"]
@@ -0,0 +1,50 @@
1
+ import importlib.metadata
2
+ import traitlets
3
+ from ..base import TerraBaseWidget
4
+
5
+ try:
6
+ __version__ = importlib.metadata.version("terra_plot_toolbar")
7
+ except importlib.metadata.PackageNotFoundError:
8
+ __version__ = "unknown"
9
+
10
+
11
+ class TerraPlotToolbar(TerraBaseWidget):
12
+ _esm = TerraBaseWidget.get_autoloader() + """
13
+ function render({ model, el }) {
14
+ // create an instance of the component
15
+ let component = document.createElement('terra-plot-toolbar')
16
+
17
+ /**
18
+ * Set initial property values
19
+ * NOTE: In reality, we won't need to have the ability to set EVERY property in a Jupyter Notebook, feel free to remove the ones that don't make sense
20
+ *
21
+ * model.get() pulls from the Jupyter notebooks state. We'll use the state to set the initial value for each property
22
+ */
23
+ component.attr = model.get('attr')
24
+
25
+ /**
26
+ * add the component to the cell
27
+ * it should now be visible in the notebook!
28
+ */
29
+ el.appendChild(component)
30
+
31
+
32
+ /**
33
+ * Set up property change handlers
34
+ * This way if someone in the Jupyter Notebook changes the property externally, we reflect the change
35
+ * back to the component.
36
+ *
37
+ * If this isn't here, the component can't be changed after it's initial render
38
+ */
39
+ model.on('change:attr', () => {
40
+ component.attr = model.get('attr')
41
+ })
42
+ }
43
+
44
+ export default { render };
45
+ """
46
+
47
+ # Component properties
48
+ # While we have properties in the component, we also need to tell Python about them as well.
49
+ # Again, you don't technically need all these. If Jupyter Notebooks don't need access to them, you can remove them from here
50
+ attr = traitlets.Unicode('').tag(sync=True)
@@ -0,0 +1,3 @@
1
+ from .slider import TerraSlider
2
+
3
+ __all__ = ["TerraSlider"]
@@ -0,0 +1,50 @@
1
+ import importlib.metadata
2
+ import traitlets
3
+ from ..base import TerraBaseWidget
4
+
5
+ try:
6
+ __version__ = importlib.metadata.version("terra_slider")
7
+ except importlib.metadata.PackageNotFoundError:
8
+ __version__ = "unknown"
9
+
10
+
11
+ class TerraSlider(TerraBaseWidget):
12
+ _esm = TerraBaseWidget.get_autoloader() + """
13
+ function render({ model, el }) {
14
+ // create an instance of the component
15
+ let component = document.createElement('terra-slider')
16
+
17
+ /**
18
+ * Set initial property values
19
+ * NOTE: In reality, we won't need to have the ability to set EVERY property in a Jupyter Notebook, feel free to remove the ones that don't make sense
20
+ *
21
+ * model.get() pulls from the Jupyter notebooks state. We'll use the state to set the initial value for each property
22
+ */
23
+ component.attr = model.get('attr')
24
+
25
+ /**
26
+ * add the component to the cell
27
+ * it should now be visible in the notebook!
28
+ */
29
+ el.appendChild(component)
30
+
31
+
32
+ /**
33
+ * Set up property change handlers
34
+ * This way if someone in the Jupyter Notebook changes the property externally, we reflect the change
35
+ * back to the component.
36
+ *
37
+ * If this isn't here, the component can't be changed after it's initial render
38
+ */
39
+ model.on('change:attr', () => {
40
+ component.attr = model.get('attr')
41
+ })
42
+ }
43
+
44
+ export default { render };
45
+ """
46
+
47
+ # Component properties
48
+ # While we have properties in the component, we also need to tell Python about them as well.
49
+ # Again, you don't technically need all these. If Jupyter Notebooks don't need access to them, you can remove them from here
50
+ attr = traitlets.Unicode('').tag(sync=True)
@@ -0,0 +1,3 @@
1
+ from .time_average_map import TerraTimeAverageMap
2
+
3
+ __all__ = ["TerraTimeAverageMap"]
@@ -0,0 +1,135 @@
1
+ import importlib.metadata
2
+ import base64
3
+ import traitlets
4
+ from ..base import TerraBaseWidget
5
+
6
+ try:
7
+ __version__ = importlib.metadata.version("terra_time_average_map")
8
+ except importlib.metadata.PackageNotFoundError:
9
+ __version__ = "unknown"
10
+
11
+
12
+ class TerraTimeAverageMap(TerraBaseWidget):
13
+ _esm = TerraBaseWidget.get_autoloader() + """
14
+ function render({ model, el }) {
15
+ // create an instance of the component
16
+ let component = document.createElement('terra-time-average-map')
17
+
18
+ /**
19
+ * Set initial property values
20
+ * NOTE: In reality, we won't need to have the ability to set EVERY property in a Jupyter Notebook, feel free to remove the ones that don't make sense
21
+ *
22
+ * model.get() pulls from the Jupyter notebooks state. We'll use the state to set the initial value for each property
23
+ */
24
+ component.collection = model.get('collection')
25
+ component.variable = model.get('variable')
26
+ component.startDate = model.get('startDate')
27
+ component.endDate = model.get('endDate')
28
+ component.location = model.get('location')
29
+ component.bearerToken = model.get('bearerToken')
30
+ component.long_name = model.get('long_name')
31
+
32
+ /**
33
+ * add the component to the cell
34
+ * it should now be visible in the notebook!
35
+ */
36
+ el.appendChild(component)
37
+
38
+
39
+ /**
40
+ * Set up property change handlers
41
+ * This way if someone in the Jupyter Notebook changes the property externally, we reflect the change
42
+ * back to the component.
43
+ *
44
+ * If this isn't here, the component can't be changed after it's initial render
45
+ */
46
+ model.on('change:collection', () => {
47
+ component.collection = model.get('collection')
48
+ })
49
+ model.on('change:variable', () => {
50
+ component.variable = model.get('variable')
51
+ })
52
+ model.on('change:startDate', () => {
53
+ component.startDate = model.get('startDate')
54
+ })
55
+ model.on('change:endDate', () => {
56
+ component.endDate = model.get('endDate')
57
+ })
58
+ model.on('change:location', () => {
59
+ component.location = model.get('location')
60
+ })
61
+ model.on('change:bearerToken', () => {
62
+ component.bearerToken = model.get('bearerToken')
63
+ })
64
+ model.on('change:long_name', () => {
65
+ component.long_name = model.get('long_name')
66
+ })
67
+
68
+ /**
69
+ * Add event listeners.
70
+ * These are used to communicate back to the Jupyter notebook
71
+ */
72
+ component.addEventListener('terra-time-average-map-data-change', async (e) => {
73
+ // hide the loading overlay, if it exists
74
+ const loadingOverlay = document.getElementById('jupyterlite-loading-overlay')
75
+
76
+ if (loadingOverlay) {
77
+ loadingOverlay.remove()
78
+ }
79
+
80
+ console.log('time-average-map: finished mapping GeoTIFF. Sending GeoTIFF to Python... ', e)
81
+
82
+ // We can't send a JS Blob to Python, so we'll instead need to convert it to bytes
83
+ const blob = e.detail.data
84
+
85
+ if (blob instanceof Blob) {
86
+ const arrayBuffer = await blob.arrayBuffer()
87
+ const uint8Array = new Uint8Array(arrayBuffer)
88
+
89
+ // Convert to base64 string for transmission to Python
90
+ // Use chunked conversion to avoid "Maximum call stack size exceeded" for large files
91
+ const chunkSize = 8192
92
+ let binaryString = ''
93
+
94
+ for (let i = 0; i < uint8Array.length; i += chunkSize) {
95
+ const chunk = uint8Array.subarray(i, i + chunkSize)
96
+ binaryString += String.fromCharCode(...chunk)
97
+ }
98
+
99
+ const base64String = btoa(binaryString)
100
+ model.set('_data_base64', base64String)
101
+
102
+ console.log('time-average-map: sent base64 encoded GeoTIFF to Python ', base64String)
103
+ } else {
104
+ console.error('time-average-map: failed to send GeoTIFF to Python. Unknown data type', blob)
105
+ model.set('_data_base64', '')
106
+ }
107
+
108
+ model.save_changes()
109
+ })
110
+ }
111
+
112
+ export default { render };
113
+ """
114
+
115
+ # Component properties
116
+ # While we have properties in the component, we also need to tell Python about them as well.
117
+ # Again, you don't technically need all these. If Jupyter Notebooks don't need access to them, you can remove them from here
118
+ collection = traitlets.Unicode('').tag(sync=True)
119
+ variable = traitlets.Unicode('').tag(sync=True)
120
+ startDate = traitlets.Unicode('').tag(sync=True)
121
+ endDate = traitlets.Unicode('').tag(sync=True)
122
+ location = traitlets.Unicode('').tag(sync=True)
123
+ bearerToken = traitlets.Unicode('').tag(sync=True)
124
+ long_name = traitlets.Unicode('').tag(sync=True)
125
+ _data_base64 = traitlets.Unicode('').tag(sync=True)
126
+
127
+ @property
128
+ def data(self):
129
+ """Get the binary data as bytes, decoded from base64."""
130
+ if not self._data_base64:
131
+ return b''
132
+ try:
133
+ return base64.b64decode(self._data_base64)
134
+ except Exception:
135
+ return b''
@@ -20,15 +20,12 @@ class TerraTimeSeries(TerraBaseWidget):
20
20
  *
21
21
  * model.get() pulls from the Jupyter notebooks state. We'll use the state to set the initial value for each property
22
22
  */
23
+ component.variableEntryId = model.get('variableEntryId')
23
24
  component.collection = model.get('collection')
24
- component.datasetLandingPage = model.get('datasetLandingPage')
25
25
  component.variable = model.get('variable')
26
- component.variableLandingPage = model.get('variableLandingPage')
27
- component.variableLongName = model.get('variableLongName')
28
26
  component.startDate = model.get('startDate')
29
27
  component.endDate = model.get('endDate')
30
28
  component.location = model.get('location')
31
- component.units = model.get('units')
32
29
  component.bearerToken = model.get('bearerToken')
33
30
 
34
31
  /**
@@ -45,21 +42,15 @@ class TerraTimeSeries(TerraBaseWidget):
45
42
  *
46
43
  * If this isn't here, the component can't be changed after it's initial render
47
44
  */
45
+ model.on('change:variableEntryId', () => {
46
+ component.variableEntryId = model.get('variableEntryId')
47
+ })
48
48
  model.on('change:collection', () => {
49
49
  component.collection = model.get('collection')
50
50
  })
51
- model.on('change:datasetLandingPage', () => {
52
- component.datasetLandingPage = model.get('datasetLandingPage')
53
- })
54
51
  model.on('change:variable', () => {
55
52
  component.variable = model.get('variable')
56
53
  })
57
- model.on('change:variableLandingPage', () => {
58
- component.variableLandingPage = model.get('variableLandingPage')
59
- })
60
- model.on('change:variableLongName', () => {
61
- component.variableLongName = model.get('variableLongName')
62
- })
63
54
  model.on('change:startDate', () => {
64
55
  component.startDate = model.get('startDate')
65
56
  })
@@ -69,9 +60,6 @@ class TerraTimeSeries(TerraBaseWidget):
69
60
  model.on('change:location', () => {
70
61
  component.location = model.get('location')
71
62
  })
72
- model.on('change:units', () => {
73
- component.units = model.get('units')
74
- })
75
63
  model.on('change:bearerToken', () => {
76
64
  component.bearerToken = model.get('bearerToken')
77
65
  })
@@ -99,17 +87,13 @@ class TerraTimeSeries(TerraBaseWidget):
99
87
  """
100
88
 
101
89
  # Component properties
102
- # While we have properties in the component, we also need to tell Python about them as well.
90
+ # While we have properties in the component, we also need to tell Python about them as well.
103
91
  # Again, you don't technically need all these. If Jupyter Notebooks don't need access to them, you can remove them from here
92
+ variableEntryId = traitlets.Unicode('').tag(sync=True)
104
93
  collection = traitlets.Unicode('').tag(sync=True)
105
- datasetLandingPage = traitlets.Unicode('').tag(sync=True)
106
94
  variable = traitlets.Unicode('').tag(sync=True)
107
- variableLandingPage = traitlets.Unicode('').tag(sync=True)
108
- variableLongName = traitlets.Unicode('').tag(sync=True)
109
95
  startDate = traitlets.Unicode('').tag(sync=True)
110
96
  endDate = traitlets.Unicode('').tag(sync=True)
111
97
  location = traitlets.Unicode('').tag(sync=True)
112
- units = traitlets.Unicode('').tag(sync=True)
113
98
  bearerToken = traitlets.Unicode('').tag(sync=True)
114
- data = traitlets.List(trait=traitlets.Dict(),
115
- default_value=[]).tag(sync=True)
99
+ data = traitlets.List(trait=traitlets.Dict(), default_value=[]).tag(sync=True)
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: terra_ui_components
3
- Version: 0.0.32
3
+ Version: 0.0.121
4
4
  Summary: NASA Terra UI Components Library
5
5
  License-File: LICENSE.md
6
6
  Requires-Python: >=3.8
7
- Requires-Dist: anywidget
7
+ Requires-Dist: anywidget>=0.9
8
8
  Provides-Extra: dev
9
9
  Requires-Dist: jupyterlab; extra == 'dev'
10
10
  Requires-Dist: watchfiles; extra == 'dev'
@@ -16,7 +16,7 @@ Intro
16
16
 
17
17
  ### Forking the Repo
18
18
 
19
- Start by [forking the repo](https://github.com/gesdisc/components/fork) on GitHub, then clone it locally and install dependencies.
19
+ Start by [forking the repo](https://github.com/nasa/terra-ui-components/fork) on GitHub, then clone it locally and install dependencies.
20
20
 
21
21
  ```bash
22
22
  git clone https://github.com/YOUR_GITHUB_USERNAME/components terra-ui-components
@@ -0,0 +1,39 @@
1
+ terra_ui_components/README.md,sha256=lBRXP8aio8W0AqDiXL9hkgGlPKfPTELiXZflujVT6BY,198
2
+ terra_ui_components/__init__.py,sha256=wrNVE-uJ_UEvl8bkdbaqYN_c7dAZ_IEi5j0r5IMWbAo,908
3
+ terra_ui_components/base.py,sha256=QdbUzI5jpshaIY5ryqoMeG8G2tlSN5OGCypKMVxafIs,1224
4
+ terra_ui_components/accordion/__init__.py,sha256=xruOtrVmmzFKacs2B_lKpEnDh2PbBq-HUKCdceRNboU,67
5
+ terra_ui_components/accordion/accordion.py,sha256=3duUmiJ5DTMYfzMJmra8pt0CXXcOkcbY-aAb7-PVCIs,1789
6
+ terra_ui_components/browse_variables/__init__.py,sha256=JfrTDLSbAecttohBx_OuEC1qT-LoqGO4egStvlJY1Os,86
7
+ terra_ui_components/browse_variables/browse_variables.py,sha256=x5DwenujlHrfzBLB29bq-b6iJtWq1AG1wOhPrDyFtIQ,1827
8
+ terra_ui_components/data_access/__init__.py,sha256=MGAx9TqVj5ydGNY_ZMrboGqBobPKbQ7kfjurotE4JtA,71
9
+ terra_ui_components/data_access/data_access.py,sha256=FOqsMhyXiff6F2aZ0SKrl2FQMZxSJdmDuZ0t-C_GwwI,1794
10
+ terra_ui_components/data_rods/__init__.py,sha256=lr-Y19evMVuC88Slu7P2sOUvsSq-BA7WUC_u_iB0V3A,65
11
+ terra_ui_components/data_rods/data_rods.py,sha256=Ot7TJQk6JgCkCoERle27RIq4lOgpfmHJNkqBgo8bbAA,1788
12
+ terra_ui_components/data_subsetter/__init__.py,sha256=iBX8RRg_T5Qix4hWgfrHcnjkx3i11xWgYAlj2g6wfx8,80
13
+ terra_ui_components/data_subsetter/data_subsetter.py,sha256=fIEcjNeT1d1v7yDGMZLfXALykKtX1jieavhuqtFaqxs,3218
14
+ terra_ui_components/data_subsetter_history/__init__.py,sha256=Hsfg61galGvfe2JoNLDtcwJhhqjVz7CFFU6noiQeLJs,102
15
+ terra_ui_components/data_subsetter_history/data_subsetter_history.py,sha256=giSXwIhCHSOOZh2VEfjLW-PWgVjDNfDN4Ep0qq2QtqY,1826
16
+ terra_ui_components/date_picker/__init__.py,sha256=RcMn156ZbrDCYOvCR4VA6p5JsR0Uj2baNPqZ4OdO02o,71
17
+ terra_ui_components/date_picker/date_picker.py,sha256=YgQxsBzAqcEuc5jHy2WUkwJ_7TVdkKHSAceYQ3Ft2pA,4952
18
+ terra_ui_components/date_range_slider/__init__.py,sha256=8rFfB6ilThf7fvuGsFZ8w4nkiRoaElCFm2_eeCDqWII,87
19
+ terra_ui_components/date_range_slider/date_range_slider.py,sha256=kE3vMFV-CZ45n8F48qE0Vrs3taPClxSrZRy8ffOEbp0,3511
20
+ terra_ui_components/dialog/__init__.py,sha256=6H2fOO3FawjPtowliaCxyneITsS4MXZy1YJYWgVKFCY,58
21
+ terra_ui_components/dialog/dialog.py,sha256=GRKktKwUpkSAE7gl8-ivZ5O18iK9oHEb2m7vKjxJIR0,1780
22
+ terra_ui_components/input/__init__.py,sha256=UIEQqNyGMwv-BkeGqVjD_A_nXhiS5Tpv6WxBD7aZibk,55
23
+ terra_ui_components/input/input.py,sha256=JTsFjXMO9jifhisaQ2fLz7OFsTxrv_4U4AIMIXbxewU,1777
24
+ terra_ui_components/login/__init__.py,sha256=R9Rn-D770XK5bIsVdQ4EwiafuISYUxYpq15zxJeyk-A,55
25
+ terra_ui_components/login/login.py,sha256=VkFUwoLKsoPq6yab5pF2Dir_NBh3oETQlnkFFCTAGyo,2682
26
+ terra_ui_components/plot_toolbar/__init__.py,sha256=rlk9bxXuNo75bIfZu91dDJupiFVOUpPzuUrMJZ5318E,74
27
+ terra_ui_components/plot_toolbar/plot_toolbar.py,sha256=VCKKZi3hD0qDAG6-exoU1hasWyG4r3A2yPo3TQ8PVoI,1797
28
+ terra_ui_components/slider/__init__.py,sha256=owsrHpY0ClCzEYWwhEnF3DFz1iKdCZ9GDKaoYV-zRb0,58
29
+ terra_ui_components/slider/slider.py,sha256=gw8jim8aBlXZgQ0l_lF4ng79KJuseyBAFmAn9JIubyo,1780
30
+ terra_ui_components/time_average_map/__init__.py,sha256=l3UBuLYIj-5-HQcugO8pRtTynkhLTD1ZlxM_Gf84t5o,84
31
+ terra_ui_components/time_average_map/time_average_map.py,sha256=EOcUeV57tmeHlEcmMm1mPmEJeYXEGzACL3J6bDaWjFQ,5318
32
+ terra_ui_components/time_series/__init__.py,sha256=uXQun39vOajxJjfOIPC4W-909Sb8QpIwatr86B8iDMA,71
33
+ terra_ui_components/time_series/time_series.py,sha256=M29nbYf-wmsxyu7WgeQu-pejF598zXuBd9MwAEIW704,3833
34
+ terra_ui_components/variable_keyword_search/__init__.py,sha256=yjNToGluREKDD4UbkIOROSdlCC4jO6sgHA741OEwVdk,107
35
+ terra_ui_components/variable_keyword_search/variable_keyword_search.py,sha256=D_jT-FAu0fubKsC0ttK_XF80ExehLnwLyvSLpVVik_o,3677
36
+ terra_ui_components-0.0.121.dist-info/METADATA,sha256=2a3oZMIPQJ-Akcfut0r6bIJ75ltfWyvdaQEK5N8UnZQ,3091
37
+ terra_ui_components-0.0.121.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
+ terra_ui_components-0.0.121.dist-info/licenses/LICENSE.md,sha256=rJ_6y_yHe29CU6SBs8DtutDAGaw1BqO1FBWzNvSgwFQ,1065
39
+ terra_ui_components-0.0.121.dist-info/RECORD,,
@@ -1,21 +0,0 @@
1
- terra_ui_components/README.md,sha256=lBRXP8aio8W0AqDiXL9hkgGlPKfPTELiXZflujVT6BY,198
2
- terra_ui_components/__init__.py,sha256=qTTHw3fdhjV9PGq3QO5dVlvBTewv4WF8vooLg4-TOLw,423
3
- terra_ui_components/base.py,sha256=JvV895IP_Ty2pI019Q8QBqU9ACGfnMHYRYfk7RA18Qw,1224
4
- terra_ui_components/browse_variables/__init__.py,sha256=JfrTDLSbAecttohBx_OuEC1qT-LoqGO4egStvlJY1Os,86
5
- terra_ui_components/browse_variables/browse_variables.py,sha256=x5DwenujlHrfzBLB29bq-b6iJtWq1AG1wOhPrDyFtIQ,1827
6
- terra_ui_components/date_picker/__init__.py,sha256=RcMn156ZbrDCYOvCR4VA6p5JsR0Uj2baNPqZ4OdO02o,71
7
- terra_ui_components/date_picker/date_picker.py,sha256=YgQxsBzAqcEuc5jHy2WUkwJ_7TVdkKHSAceYQ3Ft2pA,4952
8
- terra_ui_components/date_range_slider/__init__.py,sha256=8rFfB6ilThf7fvuGsFZ8w4nkiRoaElCFm2_eeCDqWII,87
9
- terra_ui_components/date_range_slider/date_range_slider.py,sha256=kE3vMFV-CZ45n8F48qE0Vrs3taPClxSrZRy8ffOEbp0,3511
10
- terra_ui_components/dialog/__init__.py,sha256=6H2fOO3FawjPtowliaCxyneITsS4MXZy1YJYWgVKFCY,58
11
- terra_ui_components/dialog/dialog.py,sha256=GRKktKwUpkSAE7gl8-ivZ5O18iK9oHEb2m7vKjxJIR0,1780
12
- terra_ui_components/login/__init__.py,sha256=R9Rn-D770XK5bIsVdQ4EwiafuISYUxYpq15zxJeyk-A,55
13
- terra_ui_components/login/login.py,sha256=kptEtzINeQByhL3TtQLncHoU3rYDUbRuoveuMJcCvV8,1853
14
- terra_ui_components/time_series/__init__.py,sha256=uXQun39vOajxJjfOIPC4W-909Sb8QpIwatr86B8iDMA,71
15
- terra_ui_components/time_series/time_series.py,sha256=PEXQ5Rs_sKnlLHhGxAnFKsLlrIHQ3Vg7hdqj3pC8NfI,4612
16
- terra_ui_components/variable_keyword_search/__init__.py,sha256=yjNToGluREKDD4UbkIOROSdlCC4jO6sgHA741OEwVdk,107
17
- terra_ui_components/variable_keyword_search/variable_keyword_search.py,sha256=D_jT-FAu0fubKsC0ttK_XF80ExehLnwLyvSLpVVik_o,3677
18
- terra_ui_components-0.0.32.dist-info/METADATA,sha256=WAawrD83Gj06Gigt1o0nWb7doMIJrTtapQTTvkTH8xU,3079
19
- terra_ui_components-0.0.32.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
- terra_ui_components-0.0.32.dist-info/licenses/LICENSE.md,sha256=rJ_6y_yHe29CU6SBs8DtutDAGaw1BqO1FBWzNvSgwFQ,1065
21
- terra_ui_components-0.0.32.dist-info/RECORD,,