Where is the Cartopy 's repository in Windows installed through Anaconda? - matplotlib

I would like to check what files are already in the repository of Cartopy in order to find their names and use them as part of code.
I looked for "Cartopy" in Anaconda3 directory, also look for "*.zip" files
The line where I want to use this information is the following:
ax1.add_feature(cartopy.feature.NaturalEarthFeature('cultural', 'admin_0_boundary_lines_land', '10m'),
edgecolor='black',
facecolor='none')
I would like to know names of the features available and location on disk to add more.

Related

SVHN Data questions

I have been reading and working on SO questions related to the Street View House Numbers (SVHN) datasets. The files are available at 2 different locations:
Stanford:
The Street View House Numbers (SVHN) Dataset
kaggle:
Street View House Numbers (SVHN) | Kaggle
My question is related to the format of the digitStruct.mat files for each image set (train, test, and extras). These define the name, label, and bounding box dimensions for each image. As I understand, the mat file is written as a Matlab structure in HDF5 format (that can be read with h5py).
I have been able to access and read the digitStruct.mat files from kaggle with h5py. I cannot open the same files from the Stanford site with h5py (or with HDFView). Some SO posts I've read indicate the Stanford files are an older Matlab format and should be read with scipy.io.loadmat.
Are the files at Stanford and kaggle the same?
If not, what are the differences?
Should I be able to open the Stanford digitStruct.mat files with h5py?
If so, what method should I use to download and extract the Standford tar.gz files? (FYI, I'm on Win-7, and have been using HTTP download and WinZip to extract.)
I am adding additional info to document different behavior observed with different .mat files. It may help with diagnosis.
I can open and operate on .mat files from kaggle with this call:
h5f = h5py.File('digitStruct.mat','r')
For files from Stanford, I get different errors depending on the file and function used to open.
The command below executes without an error message. That leads me to believe it is not a Matlab v7.3 file that can be opened with h5py.
mat = scipy.io.loadmat('./Stanford/test_32x32.mat')
Both of these calls do not work (brief error message provided):
mat = scipy.io.loadmat('./test/digitStruct.mat')
Traceback...
NotImplementedError: Please use HDF reader for matlab v7.3 files
h5f = h5py.File('./test/digitStruct.mat','r')
Traceback...
OSError: Unable to open file (file signature not found)
In addition, I cannot open test/digitStruct.mat with HDFView. My conclusion for the Stanford digitStruct.mat files: they might be Matlab v7.3 files, but were corrupted when I downloaded. However, I'm not sure what I did wrong (since I can download and read kaggle files without problems).
With some Linux detective work, I figured out the problem.
As I suspected, the digitStruct.mat files extracted from the *.tar.gz files on the Stanford site are HDF5 (Matlab v7.3) files, and were corrupted when I downloaded.
To confirm, I downloaded the 3 tar.gz files with a browser on a Linux system, then used the tar command to extract them, and successfully opened with h5py on Linux. I then transferred them to my Windows system, and each worked as expected with h5py.
This is a little surprising, as I have used WinZip to extract tarball files in the past. Apparently there's something special about these that caused the corruption.
Hopefully this saves someone the same headache in the future.
Note: the 3 xxxx_32x32.mat files are an older Matlab format that must be accessed with scipy.io.loadmat()

Cartopy system-wide location for natural earth shapefiles

Is there any location I can configure and put natural earth shapefiles that all users can use? My air-gapped system can't reach out to the internet to download files, so I need to point cartopy at a local store of shapefiles and configure it to look there instead of trying to reach out if it can't find them in ~/.local/share/cartopy/shapefiles/ file structure. Even the simplest tests of my install fail for this reason. I've found a few references on how to place shapefiles within that structure, so I could mimic that somewhere else. I suppose it would also be possible to symlink each user's .local/share/cartopy/shapefiles directories to a central location, but that seems like a kludge. Is there a better way that I'm missing?
EDIT: (hope this is the stackoverflow way--I am the original submitter)
OK. I'm back on this. I downloaded the ne_110m_yada_yada shapefiles unzipped them and put them in my .local/share/cartopy/shapefile/natural_earth/cultural|physical) as I found them on a connected laptop when I ran this test program:
import cartopy
import matplotlib.pyplot as plt
def main():
ax = plt.axes(projection=cartopy.crs.PlateCarree())
ax.add_feature(cartopy.feature.LAND)
ax.add_feature(cartopy.feature.OCEAN)
ax.add_feature(cartopy.feature.COASTLINE)
ax.add_feature(cartopy.feature.BORDERS, linestyle=':')
ax.add_feature(cartopy.feature.LAKES, alpha=0.5)
ax.add_feature(cartopy.feature.RIVERS)
ax.set_extent([-20, 60, -40, 40])
plt.show()
if __name__ == '__main__':
main()
That worked as expected. I hid the files in my .local cache and had my sysadmin hack the cartopy.config to point to the in /data/cartopy/ where I hoped it would find /data/cartopy/shapefiles/natural_earth/cultural|physical where the zipped data ultimately resided. Is it expecting zipped files there or is that only if it tries to go out and download them? Cartopy did not find the zip files there and tried to go to the internet. What are the rules for putting data in pre_existing_data_dir? Will cartopy find the zip files if placed in /data/cartopy/ and do the right thing. Or do I need the shapefile/natural_earth subdirectories? I'd like to just point it only as far as /data/cartopy and have it find any shapefile or raster data I have parked in that hierarchy, whatever the source. Natural Earth is merely the test case. I'm not ruling out that my sysadmin messed up, but he is extremely competent and I may have misled him.
The links and documentation provided in the initial answer were helpful, but not helpful enough for cartopy-challenged me.
Duplicate of Location of stored offline data for cartopy
In summary, a read-only cache of data can be configured with pre_existing_data_dir in cartopy.config. For a writeable cache (that cartopy can extend) data_dir is the config item. Cartopy will check the pre_existing_data_dir cache before checking the data_dir when determining whether or not it needs to fetch the resource on your behalf.
HTH
References:
Take a look at http://scitools.org.uk/cartopy/docs/latest/cartopy.html#cartopy.config for how to configure cartopy.
You may also be interested in similar questions at:
https://github.com/SciTools/cartopy/issues/734
Download data from Natural Earth and OpenStreetMap for Cartopy
*

How to add add ons to Orange3

I am using pandas to do some data analysis. Others in my company are wanting to process data in a similar fashion, but won't want to use a programming language to do it. After significant googling, I found Orange, which has the perfect interface for what I'm wanting people to do. However, the widgets don't do the types of tasks we're looking at. So, I decided to see if I could write my own widgets for Orange to do the tasks.
I'm trying to use Orange3; this seems like the best bet when I'm using WinPython. I must say that going through the documentation for widget creation (for Orange2) and the code for the Orange3 widgets is rather impressive - very nicely written and easy to use to implement what I'm wanting to do.
After writing a couple of widgets, how do I get them into Orange3? the widget creation tutorial is for Orange2 (in Python 2.7), and I haven't got it to work for Orange3.
My project is at the moment rather small:
dir/
orangepandas/
__init__.py
owPandasFile.py
pandasQtTable.py
setup.py
setup.py currently contains the following:
from setuptools import setup
setup(name='orangepandas',
version='0.1',
packages=['orangepandas'],
entry_points={'Orange.widgets': 'orangepandas = orangepandas'}
)
When I run python setup.py install on this and then try opening Orange3 canvas, I don't see my shiny new widget in its new group.
After tracing through how Orange3 imports external libraries, it seems that Orange relies on the actual widget file existing, rather than being inside a egg (zipped) file. Adding
zip_safe=False
to the setup options allowed Orange3 to import the widgets correctly. Orange3 uses os.path.exists in cache_can_ignore in canvas/registry/discovery.py to detect if the path exists at all, and if it doesn't, it doesn't try to import it. Using zip_safe=False makes sure that the addon stays uncompressed so that the individual files are accessible.
(For the next person who tries to do what I was doing.)

no module named modeller

i have started using python for using modeller software for modelling proteins. i have a plot script for plotting graphs it has a module named pylab and its not working with the modeller CMD prompt with windows7 software. and while running the same script by using python shell it showing importerror no module nemed modeller. when i asked to my higher officials he asked me to set PYTHONPATH and LD_LIBRARY_PATH variables. but i dont know how to do it..can u explain me how to set the path in layman format which i can understand easily. but then too i have tried Advanced setting->environmental variables and setting variables but i do not know how to set the path for each variables..please some one guide me with it.
There is some documentation in the python docs for how to deal with this, but it sounds like the confusion is on what to set the variable to.
If you start your command prompt (cmd.exe in the start menu), you can set a variable by using the command
SET PYTHONPATH=%PYTHONPATH%;C:\My_python_lib
The PYTHONPATH variable describes the location of the modules so python knows where to look to find them. It looks like a list of filepaths separated by semicolons.
What this command does is set the variable PYTHONPATH to its current value (the %PYTHONPATH part), adds a semicolon, and puts C:\My_python_lib at the end of the list.
You need to find the path to the pylab module (probably a folder named "pylab" with a file called __init__.py in it) and add it's location to your PYTHONPATH

Ada GPS IDE can't seem to find GtkAda

I have installed both the GNAT Programming Studio (GPS) and GtkAda. They both seem to work fine, but when I try to build the Simple Window project under New Project from Template, I get a bunch of errors saying "file gtk.ads not found." This seems to be a directory/dependency sort of problem - GPS doesn't know where to look for GtkAda. I'm running Windows 7, and have GPS installed at C:\GNAT\2011, and GtkAda installed at C:\GtkAda. I tried adding GtkAda to my PATH; at the moment my PATH user variable includes C:\GNAT\2011\bin, and my Path System variable includes C:\GtkAda\bin. Any advice on resolving this problem is greatly appreciated!
There are two things here.
First, "project" is key. Whenever you're building something that depends
on a library like GtkAda, it's much much easier if (a) you use GNAT
Project to manage it, and (b) you use the GPR(s) provided by the library
- always assuming it does, of course.
In the case of GtkAda, that means that your GPR needs to "with" GtkAda;
with "gtkada";
project Tinkering is
...
Second, gnatmake or gprbuild needs to be able to find gtkada.gpr.
The easiest way is to install GtkAda in such a way that gtkada.gpr is in
the default place that gnatmake/gprbuild expect to find GPR files. This
is $prefix/lib/gnat. GtkAda obeys this convention, so you could install
GtkAda under the same root as your compiler. I don't know why that's not recommended anyway.
If you don't want to do that, you can add the correct location to the
environment variable ADA_PROJECT_PATH, for example in your case set it
to C:\GtkAda\lib\gnat.
There is a lot of good stuff in the GtkAda README at libre.adacore.com, and in
the GtkAda User's Guide which I see from the README is also included with the
installed package at (in your case) C:\GtkAda\doc\GtkAda\gtkada_ug.