[GRASS-user] r.out.ascii not functioning for floating point values
Bartolomei.Chris
Bartolomei.Chris at ensco.com
Fri Jan 20 03:24:01 PST 2017
I am using GRASS GIS 7.2 on a Windows 10 system with 32Gb ram. OSGEO4W distribution (with msys)
The region is lat/lon (-180 to 180, 90 to -90) and the resolution NS is 00:15 and EW is 00:15
I am trying to export a raster into a grid (array) that I can use in Excel but am getting unusable output ... Here's what I do:
I create a text file in Excel with the data (University of Delaware - Global Monthly Mean Temperatures, 2014, using April) and add the header rows:
ncols 720
nrows 360
xllcorner -180
yllcorner -90
cellsize .50
nodata_value -99999
each cell has some value in it, if it isn't "-99999" then it is a floating point number (signed, 2 decimal places)
I save it as a space-sparated text file with a .asc extension
I import the raster using r.in.arc (r.in.arc input=AirTemp_Test2.asc output=AirTemp_Test2 type=FCELL --overwrite) which imports fine.
My region is set as described above and now I want to resample on the fly and export an ASCII grid I can use in Excel so I want new each row of data to have 1440 columns (since the new resolution is 2x the original)
I have tried r.out.ascii (r.out.ascii -h -m input=AirTemp_Test2 output=D:\air_temp_2014\Test2.txt precision=2 width=1440 --overwrite) but the problem I have is that it is floating point values and for some reason all of the data exported into the ASCII grid is in scientific notation with no separation between the values. In order to get an even 1440 x 720 ASCII grid, I need to check the "Write MODFLOW (USGS) ASCII array" box in the GUI and set the number of significant digits to 2 (otherwise you just get integers) and the wrapping number to 1440 ... this works fine for integers but defaults to the scientific notation for floating point which since there are no value separators, can't be worked with (integers are separated by a space). Two things: can we turn off scientific notation?, and add a separator for floating point values ... (please)
If I do not check the MODFLOW box, the grid output has the appropriate number of rows (720) but many of them have their data truncated. Every row should have 1440 values.
I have tried r.out.arc (r.out.arc input=AirTemp_Test2 output=AirTest2 dp=2 --overwrite) as well and while it generates the grid with space-separated values, they also seem to be truncated ... the truncation is not consistent either...
Am I doing something really wrong here ???
Thanks :)
Chris Bartolomei P.E.
bartolomei.chris at ensco.com
________________________________
The information contained in this email message is intended only for the use of the individual(s) to whom it is addressed and may contain information that is privileged and sensitive. If you are not the intended recipient, or otherwise have received this communication in error, please notify the sender immediately by email at the above referenced address and note that any further dissemination, distribution or copying of this communication is strictly prohibited.
The U.S. Export Control Laws regulate the export and re-export of technology originating in the United States. This includes the electronic transmission of information and software to foreign countries and to certain foreign nationals. Recipient agrees to abide by these laws and their regulations -- including the U.S. Department of Commerce Export Administration Regulations and the U.S. Department of State International Traffic in Arms Regulations -- and not to transfer, by electronic transmission or otherwise, any content derived from this email to either a foreign national or a foreign destination in violation of such laws.
More information about the grass-user
mailing list