Rainfall data

614 views
Skip to first unread message

georg...@gmail.com

unread,
Oct 4, 2022, 6:07:51 AM10/4/22
to datameet
Hello all,
 Gridded rainfall data for India in IMD is not working. I need rainfall data for Himachal from 2010 to 2022. 
Thanks

Nikhil VJ

unread,
Oct 4, 2022, 9:58:10 PM10/4/22
to datameet
Hi Georgelio,

I was able to extract the rainfall data just fine. 
Bit of programming is needed to get rid of junk data, and we need to work our way thru lot of files for multi-yr. Here is a repo with work done on it. 


I made a viz of the data for a location nr my home in Pune, and the figures appear to corelate with local history (Panshet flood of 1962 for example shows up vividly). But I'd really like to know what the original raw data was using which the gridded data was obtained.
 
I've loaded it all into a DB; should be able to get out specific data needed, let me know if you need for a particular location(s) and years range. 

Is there a use case for uploading a mirror dataset to zenodo or kaggle or someplace in simpler CSV form? (Big upload so better if there is a demand for it. Or, better if someone from the institution itself does it). I love the multi-dimensional array format they've used, but the junk values undo the storage savings (a .7z of flattened CSV may be smaller), and it's tougher to access for folks not in the know.

- Nikhil 

--
Datameet is a community of Data Science enthusiasts in India. Know more about us by visiting http://datameet.org
---
You received this message because you are subscribed to the Google Groups "datameet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datameet+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/datameet/b6a669b9-6b30-41d6-bc22-cb960814bc6en%40googlegroups.com.

VASTAV RATRA

unread,
Oct 5, 2022, 5:41:55 PM10/5/22
to datameet
Hi Nikhil
It seems like the link used to get data no longer works. The government has likely made the data inaccessible. Did you download all the files by any chance? Would it be possible to upload those in google drive?

Thanks
Vastav Ratra

georg...@gmail.com

unread,
Oct 6, 2022, 1:09:20 AM10/6/22
to datameet
Thank you Nikhil, As Vastav said that link is no longer available. Is there any chance that you have collected the data? I want data for Himachal from 2000 - 2021
Thank you 

Akshay Kumar

unread,
Oct 6, 2022, 1:23:38 AM10/6/22
to data...@googlegroups.com
Hi
Please find the attached shapefiles of the IMD Gridded rainfall dataset clipped for India for the years 1990 to 2021. Also, I am attaching the csv files of rainfall datasets, which were further used for creating shapefiles of corresponding years. Please let me know if it solves your purpose.
You can clip out Himachal from the Indian shapefile.


Profound Regards
Akshay Kumar


P Please don't print this e-mail unless you really need to. Go Green. 
Every 3000 A4 Size papers costs 1 tree.


Nikhil VJ

unread,
Oct 6, 2022, 9:08:24 AM10/6/22
to data...@googlegroups.com
Wow, Dead Internet Theory vibes 🤐

Ok, I've moved all the gridded data file copies that I had at my end to: https://server.nikhilvj.co.in/dump/imd_grid/

Disclaimer: they were download from <currently down> source on 13th July 2022, and their sha256 checksums are at: 

Beyond that digital trail, no guarantee on integrity of the data from my side. Use at own risk.

This code snippet should help you turn a file into a flat CSV table:

import imdlib
rain1 = imdlib.open_data('rain', 2010, 2010, 'yearwise').get_xarray().to_dataframe()
rain2 = rain1[rain1['rain'] > -100].reset_index()

rain2.to_csv('dump.csv',index=False)

--
Cheers,
Nikhil VJ
https://nikhilvj.co.in


Nikhil VJ

unread,
Oct 6, 2022, 9:58:07 AM10/6/22
to data...@googlegroups.com
Hi Georgelio, Vastav,


Upon browsing around the IMD site I found under Climate Monitoring in top menu, https://imdpune.gov.in/lrfindex.php
Side menu: Gridded Data Archive -> All the data is there and available just fine.


So, taking offline my data dump to save my server's bandwidth. 


--
Cheers,
Nikhil VJ
https://nikhilvj.co.in

Pankaj pandey

unread,
Oct 6, 2022, 1:25:47 PM10/6/22
to data...@googlegroups.com
Dear  Nikhil  how can batch download datahttps://imdpune.gov.in/lrfindex.php. This page give data wise data. how can download  suppose 20 year data of temperature. Any python code to do this to bulk download  in csv. Please update any code will very much neede

With Regards
P.K.Pandey




--
WITH REGARDS
DR. PANKAJ KUMAR PANDEY

Akshay Kumar

unread,
Oct 6, 2022, 2:00:18 PM10/6/22
to data...@googlegroups.com

Pankaj pandey

unread,
Oct 6, 2022, 2:26:05 PM10/6/22
to data...@googlegroups.com
Thanks Akshay for sharing the code. Actually I want to download tmax and tmin data at 0.5 degree not at 1 degree for 2000 to 2021. As I want to dowanload  gridded data  real time Download Daily Maximum Temperature data ( 0.5 x 0.5 degree) Binary File (Real-time). In this page only the select data option is available. Should i  replace year with data  in code.
It is requested please modify code for this case

with regards
p.k.pANDEY



Nikhil VJ

unread,
Oct 11, 2022, 11:00:46 PM10/11/22
to data...@googlegroups.com
Hi Pankaj,

The place initially referred to is archival data - by definition it's historic and not realtime.
What I do see on https://imdpune.gov.in/lrfindex.php is "Gridded Data Real Time" -> you might want to explore that.
Over there, Daily 0.5x0.5 grid temp data links are there.
You can select a single date there and download the file.

I don't know right now how to open it, though. imdlib library that I've used - I didn't see anything about daily data. 

I've posted a query about it in the lib's github : https://github.com/iamsaswata/imdlib/issues/17 , let's see if the author responds. Perhaps some inspection of the source code also might yield a way to open the daily data.

PS: Next time do initiate a separate conversation with a different subject line - as here you have asked about temperature data but the subject reads rainfall data. Becomes less discoverable over the open internet or after a long period of time.

--
Cheers,
Nikhil VJ
https://nikhilvj.co.in

Nikhil VJ

unread,
Oct 14, 2022, 8:11:34 AM10/14/22
to data...@googlegroups.com
Hi All,

Got a request regd need to simplify this IMD grid data fetching process for folks, and that gave me impetus to complete setting up a website where individual location + year data can be downloaded as simple flat CSV (which opens in Excel / LibreOffice Calc).

So here it is: https://server.nikhilvj.co.in/imd_data/

There's a map and year selector to help choose, after that a link is generated for downloading. Open that in browser or do wget/curl on commandline, and it'll download a CSV with proper naming.

Sample link:

You are encouraged to scrape : use the format above to compose your own link. (Hint: Excel formulas like: =A2&B2&"?year="&C2 are perfect for this)

With a caveat: Given that it's not some fancy server that can take huge loads, there's a cruel and harsh rate limiter in place which will allow only 1 hit per 10 secs per IP address for anonymous users. 

If you want to bypass that, there's an email-otp login process given which will add a token and let you do 5 hits per second, and that won't be restricted by IP address.
This would be useful in institutions where multiple users on the same network may want to fetch data at the same time. 
ex: a school/college hands-on session in climate data visualization where the host as usual forgets to pre-download the data
So you can scrape and I can keep my server from crashing - both sides win.

Source code is at https://github.com/answerquest/IMD-grid-data-work (see imd_data_api folder)


--
Cheers,
Nikhil VJ
https://nikhilvj.co.in

Pankaj pandey

unread,
Oct 14, 2022, 11:42:29 AM10/14/22
to data...@googlegroups.com
Dear Nikhil I am trying to download  temperature data  for 2000 of Assam and getting this massage: {"success":false,"message":"No data for give location / year"}. What is problem Please how to download temperature data at 0.5 degree for all grid point of assam

Nikhil VJ

unread,
Oct 14, 2022, 2:25:20 PM10/14/22
to data...@googlegroups.com
Hi Pankaj,

Added in the webpage now:

And even after that, for some locations there just isn't data for certain years or dates in the original dataset. Those slots were filled with junk values in the .grd files like -999 - they've been sanitised out from here.

You just need to keep looking for a location that gives you data and let go of the ones that don't, that is all. Not much anybody can do if IMD itself didn't archive it.

Please also see the other instructions in the page.
0.5 grid : select accordingly on the map.

For Assam : you'll have to select the grid points coming within assam, and try for them.

For bulk work, Generate 1 link, then copy the same structures to create more links with the year value in the URL changed.

--
Cheers,
Nikhil VJ
https://nikhilvj.co.in

Pankaj pandey

unread,
Oct 15, 2022, 2:35:11 AM10/15/22
to data...@googlegroups.com
Dear Nikhil still has the same issue for Assam.  I tried to download at  26.5,93.0 for 2001 temperature  data again getting a similar message of no data. PLease check the issue

With regards

Akshay Kumar

unread,
Oct 15, 2022, 2:41:11 AM10/15/22
to data...@googlegroups.com
Dear Sir,
The code link that I sent has to be changed for tmax and tmin parameters. Once it is done, you can have the csv files, which can be clipped further with the desired area.




 
Profound Regards
Akshay Kumar


P Please don't print this e-mail unless you really need to. Go Green. 
Every 3000 A4 Size papers costs 1 tree.

Anil Dandekar

unread,
Oct 23, 2022, 3:24:39 PM10/23/22
to data...@googlegroups.com
dear all, i am unable to understand the files link given in github, how to run it and any proper material (document/videos) to read it and proceed further.
Dr. Anilkumar T Dandekar
Associate Professor of Agricultural Engineering
in Soil and Water Conservation Engineering
Dept of Agricultural Engineering,
College of Agriculture,
VC Farm, Mandya-571405


Nikhil VJ

unread,
Oct 24, 2022, 10:42:05 PM10/24/22
to data...@googlegroups.com, anil...@gmail.com
Hello Dr.Anilkumar,

I've simplified the process much through this website : https://server.nikhilvj.co.in/imd_data/

image.png

Pick a location on the map, choose a year, press the button, and click the link that comes below. You'll get a simple CSV table with the datewise data for chosen location and year.


--
Cheers,
Nikhil VJ
https://nikhilvj.co.in
Reply all
Reply to author
Forward
0 new messages