India Map Visualization Python and Basemap

Visual representation of data is most important aspect of presenting views to customers or layman. Doing data analysis with Python is quite easy with help of packages like Pandas and Matplotlib.

For Map Visualization, one needs Basemap.

I recommend using Anaconda for Data Analysis purposes due to its simplicity of package installation. One needs to install basemap using simple command in Command Terminal.

  • conda install basemap

This command will install basemap and required dependencies will be installed or updated.

Creating Map

For map, we needs basic thing like latitude and longitude with box details around map.Here we are going to use India (obviously).This information can be obtained by this Boundingbox. Search “India” in search box at top left

boundingbox.png

Now on lower corner left hand side from drop down list select “Dublin Core”. Lower center will show ” westlimit=68.11; southlimit=6.55;eastlimit=97.4;northlimit=35.67″.

Westlimit and Southlimit togther are “lower left corner” while eastlimit and northlimit are “upper right corner”. (If you full Map of India i.e with all of Jammu and Kashmir northlimit will be 37.)

Now we need shape files 1) ArcGIS (with disputed area) 2) Diva-GIS (without disputed area). For simplicity I am using Diva-GIS shape files.

Actual Coding

First import packages :

imports

Now data to visualize

data

You can get Aadhar Saturation data from state-wise-aadhaar-saturation. You need to extract pdf tables into csv. To match shape files (Diva-GIS) you need to check state names with India_adm1.csv file.

Now map creation and add shapefile

fig

shape

This is fairly explanatory. Basemap arguments contain resolution which is set to c i.e crude, llcrnrlon = westlimit = 68, llcrnrlat= southlimit=6, urcrnrlon= eastlimit=97 and urcrnrlat=northlimit=35 or 37. lat_0 and lon_0 are for centre point of map. We read shapefile from India_adm1 which consist state boundaries.

crudemap.png

This is how crude map looks like. We still aren’t done.Plotting points are done by

plottingpoint

Dataframes bind areas and respected saturation values together. Now we need to add color and set resolution.

color.png

Finally , the output is this.

Aadhar_Saturation

You can download code from here.

Visit these for more info 1 and 2.

 

Advertisements

Nvidia Geforce Experience Not Working

I updated my Nvidia drivers to recent one. But it gave weird error “Geforce Experience Stopped . Try Restarting”.

The solution was to change logon account of Nvidia Telemetry.

1) Press “Win+R” , Type “services.msc”

services

2) Goto “Nvidia Telemetry Container ” and Click it.

nvidiatele

3) Goto Logon Tab and select “local system account”

logon

Done.

You can open Nvidia Geforce Experience now.

If above solution doesn’t work update your drivers to latest.

Fixing Function (Fn) Not working in Linux Mint 18.3 on Asus FX553VE

I bought Asus FX553VE somedays back. I installed Linux Mint 18.3 as I use Linux for most of my work. I noticed Fn (function) combination is not working for brightness and key board backlight. I tried every method provided on Ubuntu Forums and ever where else but no use.

One method worked but only to control KEYBOARD BACKLIGHT i.e Installing kernel 4.15.One can install 4.15 kernel in Linux Mint by following steps:

  1. Goto Update Manager -> View -> Linux kernelsLinux Kernel
  2. Then Goto 4.15 -> 4.15(latest one which is at top) -> Installkernel.png

This is can make Fn + Keyboard backlight working. But Brightness is still broken. Hope future kernels will add brightness control support. (Even Nvidia drivers didnt get install. Nvidia PPA installs driver correctly.)

UPDATE : I installed new Linux Mint 19 Beta. All Fn + keys are working. Only headache is Nvidia drivers mess up everything. .

 

Windows Games on Mac OSX Yosemite/El Capitan

A year ago, I started using Mac OSX due to some work. Before I was and still using Xubuntu (ardent fans of Linux based OSes). Then I noticed I cant have some playtime on it. I have large stash of Windows Based Games but they will be useless on Mac OSX.

I searched and found the best way , better than Bootcamp (Bootcamp truly sucks) i.e install WINE. I have used WINE before for play odd titles on Xubuntu. Thus I was relieved to found it. Best way to install WINE is from  Homebrew also it requires dependency xquartz. Type following to Install

brew install wine

brew install xquartz

You can also use winetricks from Homebrew.

These are some titles that I found worth playing with WINE on Mac OSX. Don’t expect AAA  titles.

Assassin’s Creed / II

maxresdefaultAssassin’s Creed install without error and plays better on WINE even than on Windows.Well if you are fan then surely try it.

Counter Strike : Condition Zero

headerInstalls without error , run fantastic. More fun. I haven’t tried Multiplayer Mode.But its best.

NFS Underground 2

need-for-speed-underground-2-maxhungama-2

Not my favourite but it runs good.

 

You can also try and install Devil May Cry (2013). It worked for me in beginning but crashed after.

WINE is best for installing Windows based applications on Mac OSX. Saves money (buying Parallels Desktop or Windows) and saves space (installing Windows via Bootcamp).

Happy Gaming On Mac OSX with WINE. 🙂 🙂 🙂

 

Homebrew Essentials Software for OSX

Homebrew is bane to newbie on Mac OSX. It has tons of packages that Linux users adore. Few of following software will make Linux user happy.

  1. Git  : –  How can one forget this. You can install it by just typing  brew install git
  2. Midnight Commander : – My personal favorite terminal. Same procedure to install.
  3. Youtube-dl :- Its is present in package manager.
  4. Java :- Everybody needs it now.Can install it by brew cask install java
  5. ZSH :- I love ZSH. Same procedure to install.

 

Well these are my favorites but Homebrew has tons of pacakages to select from. So install Homebrew and enjoy Mac OSX.