carpentries-incubator / jupyter_maps Goto Github PK
View Code? Open in Web Editor NEWInteractive Maps in the Jupyter Notebook
Home Page: https://carpentries-incubator.github.io/jupyter_maps/
License: Other
Interactive Maps in the Jupyter Notebook
Home Page: https://carpentries-incubator.github.io/jupyter_maps/
License: Other
With Python 3.6.7 and having installed jupyter labextension install @jupyter-widgets/[email protected]
, using embed_minimal_html()
results in the following error:
1 from ipywidgets.embed import embed_minimal_html
2
----> 3 embed_minimal_html('carpentries_instructors_basic.html', views=[map], title='The Carpentries Instructors')
~/anaconda3/envs/jupyter-maps/lib/python3.6/site-packages/ipywidgets/embed.py in embed_minimal_html(fp, views, title, template, **kwargs)
300 {embed_kwargs}
301 """
--> 302 snippet = embed_snippet(views, **kwargs)
303
304 values = {
~/anaconda3/envs/jupyter-maps/lib/python3.6/site-packages/ipywidgets/embed.py in embed_snippet(views, drop_defaults, state, indent, embed_url, requirejs, cors)
277 values = {
278 'load': load.format(embed_url=embed_url, use_cors=use_cors),
--> 279 'json_data': escape_script(json.dumps(data['manager_state'], indent=indent)),
280 'widget_views': widget_views,
281 }
~/anaconda3/envs/jupyter-maps/lib/python3.6/json/__init__.py in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
236 check_circular=check_circular, allow_nan=allow_nan, indent=indent,
237 separators=separators, default=default, sort_keys=sort_keys,
--> 238 **kw).encode(obj)
239
240
~/anaconda3/envs/jupyter-maps/lib/python3.6/json/encoder.py in encode(self, o)
199 chunks = self.iterencode(o, _one_shot=True)
200 if not isinstance(chunks, (list, tuple)):
--> 201 chunks = list(chunks)
202 return ''.join(chunks)
203
~/anaconda3/envs/jupyter-maps/lib/python3.6/json/encoder.py in _iterencode(o, _current_indent_level)
428 yield from _iterencode_list(o, _current_indent_level)
429 elif isinstance(o, dict):
--> 430 yield from _iterencode_dict(o, _current_indent_level)
431 else:
432 if markers is not None:
~/anaconda3/envs/jupyter-maps/lib/python3.6/json/encoder.py in _iterencode_dict(dct, _current_indent_level)
402 else:
403 chunks = _iterencode(value, _current_indent_level)
--> 404 yield from chunks
405 if newline_indent is not None:
406 _current_indent_level -= 1
~/anaconda3/envs/jupyter-maps/lib/python3.6/json/encoder.py in _iterencode_dict(dct, _current_indent_level)
402 else:
403 chunks = _iterencode(value, _current_indent_level)
--> 404 yield from chunks
405 if newline_indent is not None:
406 _current_indent_level -= 1
~/anaconda3/envs/jupyter-maps/lib/python3.6/json/encoder.py in _iterencode_dict(dct, _current_indent_level)
402 else:
403 chunks = _iterencode(value, _current_indent_level)
--> 404 yield from chunks
405 if newline_indent is not None:
406 _current_indent_level -= 1
~/anaconda3/envs/jupyter-maps/lib/python3.6/json/encoder.py in _iterencode_dict(dct, _current_indent_level)
402 else:
403 chunks = _iterencode(value, _current_indent_level)
--> 404 yield from chunks
405 if newline_indent is not None:
406 _current_indent_level -= 1
~/anaconda3/envs/jupyter-maps/lib/python3.6/json/encoder.py in _iterencode_list(lst, _current_indent_level)
323 else:
324 chunks = _iterencode(value, _current_indent_level)
--> 325 yield from chunks
326 if newline_indent is not None:
327 _current_indent_level -= 1
~/anaconda3/envs/jupyter-maps/lib/python3.6/json/encoder.py in _iterencode(o, _current_indent_level)
435 raise ValueError("Circular reference detected")
436 markers[markerid] = o
--> 437 o = _default(o)
438 yield from _iterencode(o, _current_indent_level)
439 if markers is not None:
~/anaconda3/envs/jupyter-maps/lib/python3.6/json/encoder.py in default(self, o)
178 """
179 raise TypeError("Object of type '%s' is not JSON serializable" %
--> 180 o.__class__.__name__)
181
182 def encode(self, o):
TypeError: Object of type 'MetaHasTraits' is not JSON serializable
Running the Copernicus Data Store step fails because .cdsapirc hasn't been created. I would recommend adding a link to https://cds.climate.copernicus.eu/api-how-to and noting that this must be set up first (after registering with CDS). I'd be happy to submit a pull request with this change.
@fmichonneau has updated the lesson template to enable support of Incubator lessons!
This update:
Creates a top-of-page banner to indicate that this lesson is in the incubator (and not an official Carpentries lesson). This banner is in addition to the existing "lesson life cycle" banner that appears on some official Carpentries lessons (for example the geospatial lessons) to indicate whether lessons are pre-alpha, alpha, beta, or stable.
Changes the license information to make it clear the copyright is not held by The Carpentries or any of its lesson programs.
Replaces The Carpentries (or SWC/DC/LC) logo in the upper left hand corner of the template with The Carpentries Incubator logo.
@fmichonneau and I are happy to do the heavy lifting of bringing this template into your lesson repository (or helping you with the logistics if you'd like to try it yourself). Once this has been done, your lesson will appear on a "Community Contributed Lessons" page on The Carpentries website!
Please respond to this issue to let us know if you approve these changes. Please also indicate whether you would prefer to pull in the template update yourself, or would prefer @fmichonneau and I to take the lead on that. Looking forward to posting your lesson publically and getting the word out about this awesome resource!
I got very good tips on how to improve material:
nicer way to format the html string (without having to add + signs and loads of """ etc):
html = """
also if want to avoid for i in range(0, len(list)) can use for element in list, which iterates through list elements, eg
for element in features:
location = (element['geometry']['coordinates'][1],element['geometry']['coordinates'][0])
To run jupyter labextension install
, both npm and nodejs must already be installed (and sufficient versions).
On my mac, I resolved this by using homebrew to install npm (brew install npm
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.