Indian Forum for Water Adroit

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - subash

Pages: [1] 2 3 ... 5
1
Announcements / Call for Phd at IIST- Trivandrum
« on: November 13, 2018, 03:46:57 PM »
https://www.iist.ac.in/admissions/phd/regular

Applications last date : November 14, 2018 through on-line only

2
Programming / Re: Writing two dimensional netCDF file in python-Reg
« on: February 09, 2018, 04:38:50 PM »
Hi Diwan,

No problem.

I am not sure what is the problem with data turning into 1D. Try to feed the data as 2D when ur writing to a .nc file. After u set check precp[:],if the data turns out to be 2-D we are good, otherwise need to check what is turning 2D to 1D.


HTH

3
Programming / Re: Writing two dimensional netCDF file in python-Reg
« on: February 08, 2018, 10:26:13 PM »
Hi Diwan,

I am dumping the gdalinfo to see what is wrong with the test.nc file u shared.


Code: [Select]
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Driver: netCDF/Network Common Data Format
Files: /home/subash/Downloads/test.nc
Size is 52, 57
Coordinate System is `'
Metadata:
  NC_GLOBAL#description=Example dataset
  NC_GLOBAL#history=Created on Thu Feb 08 09:22:33 2018
  prec#units=mm
  prec#_FillValue=-9999
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,   57.0)
Upper Right (   52.0,    0.0)
Lower Right (   52.0,   57.0)
Center      (   26.0,   28.5)
Band 1 Block=52x1 Type=Float32, ColorInterp=Undefined
  NoData Value=-9999
  Unit Type: mm
  Metadata:
    NETCDF_VARNAME=prec
    units=mm
    _FillValue=-9999

We can see from the dump that the file is missing the lat-long coordinates information.

So, to understand what could be likely error i created a similar  test case as below:

Code: [Select]
nc_file = Dataset('Test1.nc','w',format='NETCDF4')

nc_file.description = 'Example dataset'
nc_file.history = 'Created on ' +time.ctime(time.time())

#Defining dimensions
lon = nc_file.createDimension('lon',57)
lat = nc_file.createDimension('lat',52)

#Creating variables
latitude = nc_file.createVariable('lat','f4',('lat',))
latitude.units = 'Degree_North'
longitude = nc_file.createVariable('lon','f4',('lon',))
longitude.units = 'Degree_East'

prec = nc_file.createVariable('prec','f4',('lon','lat'),fill_value = -9999.0)
prec.units = 'mm'

[code]#Writing data to variables
lats = np.arange(16.875,19.425,0.05)
lat_reverse = lats[::-1]
lons = np.arange(73.325,76.175,0.05)
latitude[:] = lat_reverse
longitude[:] = lons

prec[:] = np.arange(0,prec.size,1)
nc_file.close()

U can see the gdal header info for the file Tes1.nc


Code: [Select]
abc@Lenovo-G50-80:~$ gdalinfo Test1.nc
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Driver: netCDF/Network Common Data Format
Files: /home/subash/Downloads/Test1.nc
Size is 52, 57
Coordinate System is `'
Origin = (19.449999229580747,76.150000027247842)
Pixel Size = (-0.049999985040403,-0.050000054495675)
Metadata:
  lat#units=Degree_North
  lon#units=Degree_East
  NC_GLOBAL#description=Example dataset
  NC_GLOBAL#history=Created on Thu Feb  8 22:21:15 2018
  prec#units=mm
  prec#_FillValue=-9999
Corner Coordinates:
Upper Left  (  19.4499992,  76.1500000)
Lower Left  (  19.4499992,  73.2999969)
Upper Right (  16.8500000,  76.1500000)
Lower Right (  16.8500000,  73.2999969)
Center      (  18.1499996,  74.7249985)
Band 1 Block=52x1 Type=Float32, ColorInterp=Undefined
  NoData Value=-9999
  Unit Type: mm
  Metadata:
    NETCDF_VARNAME=prec
    units=mm
    _FillValue=-9999

I had run the case on Ubuntu 14.04 LTS and  nc.__version__ =  '1.2.4'

4
Programming / Re: Writing two dimensional netCDF file in python-Reg
« on: February 08, 2018, 05:30:35 PM »
Hi Diwan

I think the problem is with the variableName used. The variables associated with the dimensions should have the same name as the dimensions. Change these lines

Code: [Select]
latitude = nc_file.createVariable('Latitude',float32,('lat',))
longitude = nc_file.createVariable('Longitude',float32,('lon',))
 


Modified :

Code: [Select]
#Creating variables
latitude = nc_file.createVariable('lat',float32,('lat',))
longitude = nc_file.createVariable('lon',float32,('lon',))

5
Data / SOI toposheet data : 1:250K scale
« on: July 12, 2017, 12:04:23 PM »
Data can be downloaded free @ http://www.lib.utexas.edu/maps/ams/india/

6
Programming / Re: Exporting High Resolution figures from 'R'
« on: July 07, 2017, 12:57:24 PM »
A small addition to what Karthik has touched upon, If you are not getting the plots in the Rstudio plot window, just check if the graphics handle is clear or not.. You can do that by checking dev.list().. If the result is NULL then you are good to plot or you have clear the graphics window before you plot to view the plot in the plot window and if you wish to save without viewing the plot then dev.off() is definite.

Code: [Select]
> dev.list()
png
  4

> dev.off(4)
null device
          1

> graphics.off()

7
Data / Re: High resolution irrigation maps for India : 2000-2015
« on: February 10, 2017, 11:44:52 PM »
The irrigation maps shared by Prof.Vimal mishra at url mentioned above, only shows which areas are irrigated/non-irrigated. Irrigation quantity data is not shared. Is it for security reasons?

8
Post your question/information / Re: Quantile Mapping for bias correction
« on: January 31, 2017, 06:52:31 PM »
@ Guillaume Dueymes. The bias_correction function is in stats file.

You should import the bias correction method as below:

Code: [Select]
from ambhas.stats import bias_correction

Subash

9
Programming / Re: Python Resources for Hydrologists
« on: January 06, 2017, 11:22:58 AM »
Congrats Sat Kumar.. Your contribution for the Python community @ Python in Hydrology and library AMBHAS have been listed @ http://abouthydrology.blogspot.in/2016/11/python-resources-for-hydrologists.html

10
Data / High resolution irrigation maps for India : 2000-2015
« on: December 28, 2016, 01:05:54 PM »
Annual irrigated area maps at a resolution of 250 metres for the period 2000-2015 covering all the agroecological zones of India were developed and published by Prof. Vimal Mishra from IIT-Gandhinagar and his team.

Link to the article : http://www.nature.com/articles/sdata2016118

The maps can be downloaded @ : https://figshare.com/articles/Irrigated_Area_Maps_for_India/3790611/1

11
Programming / Re: R vs Python
« on: December 23, 2016, 08:43:50 PM »
My views with little experience in all the three scripting languages are as below:

Sat hit the nail on the head by saying learn by coding is the best way to learn any programming language, does'nt matter which you pick. All the programming languages can solve most of the problems but picking which one is the best is very case specific. However, for solving most research problems any one among the three is ok to get started/solve ur problem. Most research students pick MATLAB because it can be very easy to learn. R has very deep learning curve and Python comes in between.

Most of the packages/algorithms in WaterResources you can most likely find in R or MATLAB.

Hello World : You can learn interactive code  @ https://www.codecademy.com/, https://www.codeschool.com/ & https://www.datacamp.com/

ShapeFile/Raster : Coming and Python and R w.r.t GIS, although the core algos in ArcGIS/QGIS/GRASS are written in C, many packages/libraries for GIS are written in Python. As a result you see many packages in Python and R which can talk to arcGIS/QGIS/GRASS. So, if you handle lot of satellite data processing, it is good to go with R/Python.

Rewards : There are many programming courses being offered in https://www.coursera.org/   Matlab/Python/R. Pick any , do the course and you can write it on ur CV.
(2) You can take part in coding challenges which happen everyday/week  https://www.analyticsvidhya.com/ , https://github.com/ and topcoder.com to name a few, you can take part and put  your ranking on the CV.


Finally, It takes about 10 years to master one programming language. But, once you get started with one, you can easily pick the other.

Happy Coding

12
Programming / R vs Python
« on: December 08, 2016, 05:46:27 PM »
This blog gives a nice intro and comparison between R and Python. Some popular packages and the scripting language to choose for your work are described eloquently.

https://www.datacamp.com/community/tutorials/r-or-python-for-data-analysis#gs.3KXWxKM

13
Data / Re: Free GIS data
« on: November 28, 2016, 02:52:52 PM »
Kabbilawsh, As i understand your problem is u have extracted/downloaded  few district boundaries   in India from may be 3 sources lets say A,B, and C and u find a disparity among the three.. So, there is a confusion of which one is correct? So, authenticity of the data is the question.

One source which i think of is Bhuvan (http://bhuvan.nrsc.gov.in/state) which does provide the option of district boundaries for a state..As this from our Space Agency i hope the boundaries are reliable.

Another is GADM database (www.gadm.org), which i use for my work.


Hope that helps



14
Programming / Re: Memory allocation size error in R
« on: July 09, 2016, 10:33:02 AM »
Though you got the error at the line posted, it is not looking for me that rmaxstab is causing memory trouble as you are generating only one number , n=1.

May be it is imperative that you check the object sizes in you workspace, so that we can know which variable is taking more space.

object.size(x=lapply(ls(), get))
print(object.size(x=lapply(ls(), get)), units="Mb")

15
Programming / Re: Memory allocation size error in R
« on: July 08, 2016, 11:28:57 PM »
Can you also post the R.Version() and Sys.info() outputs, as for the comments in http://stackoverflow.com/questions/1395229/increasing-or-decreasing-the-memory-available-to-r-processes a 32bit R version  installed on WIndows 64 bit can only use up to 3Gb of RAM, regardless of how much you have installed.

Pages: [1] 2 3 ... 5