Has basemap become outdated? - python-3.x

I'm currently coding Python 3.6 and using basemap 1.0.7. I am running into problems with the toolkit, which seems to be because it is using now-deprecated functions of matplotlib. Just to name a few:
"MatplotlibDeprecationWarning: axes.hold is deprecated"
"MatplotlibDeprecationWarning: The get_axis_bgcolor function was deprecated in version 2.0. Use get_facecolor instead."
I can't follow the guides, due to limited/missing functionality.
Questions tagged with matplotlib-basemap seem to be somewhat active. Am I missing something? Are people still having success with basemap? If not, are there some alternatives available? I've looked at plotly, vincent, and geoplotlib. I've run into deprecation errors using the latter two, and I'd like something completely open, not requiring sign-up as Plotly.

Related

Upgrading from scipy to imageio

I'm quite new to Python so bear with me, I downloaded a github project for Document Forgery Detection that works with 3.6 and buried within it is scipy.misc.imsave which is deprecated.
The call to scipy.misc.imsave only has one parameter but I can't find documentation for that call, only for two parameter methods.
So when I tried to upgrade to what I found recommended online, imageio I replaced the calls as so.
Before
scipy.misc.imsave(self.imageOutputDirectory + "MarkedImage")
After
imageio.imwrite(self.imageOutputDirectory + "MarkedImage")
Of course this doesn't work as it expects two params. The problem is I can't figure out what the original implementation was somehow passing to scipy to reference it, is it some inherited method in the class?

TypeError: can't pickle dict_keys objects calling mdl.solve() in cplex

I have an OR problem and using an academic version of cplex library in the jupyter notebook by python 3.6.
When I am calling the following command I get an error:
command:
solution=mdl.solve(log_output=True)
error:
TypeError: can't pickle dict_keys objects
when I removed (log_output=True) everything works just fine, but I need the detailed output.
Since this is a crossed reference question, I would rather not repeat myself and confuse other people. The reason to ask here is that different scholars are attending these two reference webpages.
https://github.com/IBMDecisionOptimization/docplex-examples/issues/14
If I find my answer in stackoverflow I will share the solution procedure here and on github.
From the solution found in the external link: the problem is fixed in docplex ersion 2.10.150. Upgrading to that version fixes the problem.
As Daniel Junglas mentioned there were some inconsistencies between the two version of docplex toolbox and cplex 12.9 academic version I was using. A member of IBM team noticed the problem and updated the docplex version. And the lastest version up to date 07/08/2019 is here https://pypi.org/project/docplex/2.10.150/.
Many thanks to IBM Team.

How to use UpdateLayerStatistics() and GeodesicLength() in Python 3 sqlite

Support for pyspatialite appears to have been overlooked for Python 3.x. The erstwhile replacement, sqlite3, is missing some critical functions such as UpdateLayerStatistics() and GeodesicLength().
The answer offered by #heibert here affirms that the installation package has not been updated for Python 3. That response is more than 4 years old, implying that support is not likely forthcoming.
There is a replacement package, sqlite3, but the queries with the aforementioned functions throw errors with that package imported.
What is the appropriate solution to install pyspatialite in Python 3? or
What are their renamed counterparts in sqlite3 (if they exist at all)? or
What is the proper package to access those and other functions previously available in pyspatialite?
The best response I found was by sandro here which explains both why pyspatialite is obsolete and what to do to overcome the issue.

how to use katex macros in gitlab?

I just started using GitLab, and to avoid having the math and the code in different places, I would like to use the GitLab wiki to "store" the math. Writing the equation would be simpler if I had katex macros or definitions available. However, they appear to not be working.
I've tried all the examples in the Katex docs [https://katex.org/docs/supported.html#macros], making changes where necessary, but they do not work (i.e. do not render properly).
Example 1 (from the katex docs):
```math
\def\foo{x^2} \foo + \foo
```
is rendered as :
\def\foox2\foo+\foo
and not as x^2+x^2.
My institution has version 11.3.3 installed.
\def was added in 0.10.0-beta but gitlab appears to be using katex 0.8.3 on v11.3.3.
There is an open issue for upgrading to 0.10.0 (https://gitlab.com/gitlab-org/gitlab-ce/issues/56507) for the same reason you are interested in.

How can I load Raphael within IPython notebook, avoiding some issues that arise due to require.js?

In an IPython notebook, one would expect the following code to cause Raphael.js to load successfully into the global namespace.
from IPython.display import Javascript
raphael_url = "https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"
Javascript('alert(Raphael);', lib=[raphael_url])
However, it does not work in recent versions of IPython which use require.js. Turns out, Raphael.js, which IPython loads using jQuery.getScript(), recognizes the presence of require.js and as such does not insert itself into the global namespace. In fact, if one first runs javascript code removing the window.define object, Raphael no longer realizes require.js is present, and it inserts itself into the global namespace as I would like. In other words, the code above works after running the following:
Javascript('window.define = undefined;')
Thus, the only way I am able to get Raphael to load within a recent version of IPython notebook is to delete (or set aside) window.define.
Having identified the problem, I am not familiar enough with require.js to know what piece of software is acting against protocol. Is Raphael using a poor way of testing for the existence of require.js? Should IPython be using require.js directly instead of jQuery.getScript() when it loads user-provided javascript libraries? Or is there a way I as the user ought to be embracing require.js, which will give me the Raphael object without needing any special hacks? (If the answer to the last question is yes, is there a way I can also support older versions of IPython notebook, which do not use require.js?)
The first part of my answer won't please you, but the loading and requirement of javascript library in the IPython-notebook-webapp has not yet been solved, so for now I would suggest not to build to much on the assumption you can load library like that, and rely more on custom.js for now.
That being said, if raphael is not in global namespace require is smart enough to cache it, and give you reference to it. Then in the callback you can just assign to a global :
require(['raphael'], function( raph ){
window.raphael = raph;
})
Or something like that should do the trick.

Resources