I have the climatology (1971-2000) temperature and salinity data for the European Shelf from Berx & Hughes (2009) Con Shelf Res 29, 2286-2292. Each of the datasets have a resolution of 1/6 deg longitude by 1/10 deg latitude.
From the raw files I have created a raster (*.asc) file with the following header:
While this created a raster with the LL point correct the raster has square tiles and does not match the correct coverage. I have tried using the raster RESCALE function to multiply the Y-values by 0.59988 to bring them correct, but the result is a raster comprising lines (rows) of square, rectangle, rectangle, square, rectangle, rectangle, etc etc rather than all the original squares becoming rectangles.
I have also tried making the rasters at 0.1 dd and multiplying the other axis by 1.667 but the same thing happens.
I'm using 10.2 and have heard of problems with rasters. Do I need a different version or a different process?
I'm wishing to stretch all the squares to rectangles and do so, so they are all 1/6 deg longitude by 1/10 deg latitude.
I just tried rescaling a raster, and it seemed to work fine. If you look at the details for the raster (Properties -> Source), do you see the expected cell size information displayed? It's possible that it's a display issue, and the output raster is correct, depending on the scale you're looking at the data.
The ASCII driver doesn't support non-square pixels for import, another alternative is to do an initial conversion to a format that does support rectangular cells. For example, you can use GDAL to create a Golden Surfer compatible ASCII grid, by adding DX and DY elements instead of CELLSIZE:
With that alternate header, you can use gdal_translate to output a GeoTIFF which is almost universally readable:
gdal_translate -of GTiff output.tif input.asc
Another alternative would be to write out the file as a BIL and generate a header with differing X and Y heights, but I'd recommend the solution above over it.
Thanks for your reply.
There are a few odd things here and you have suggested a good plan.
As the resolution is 1/6 deg longitude by 1/10 deg latitude I can either create the raster at 0.16667 degree spacing and shrink the x-axis, or at 0.1 degree and expand the Y-axis and I've tried both. Here the example is with the spacing at 0.16667; 150 C and 170 R. After resizing with the x-axis kept at 1.0 and the y-axis expanded by 1.667 the cellsize is now 0.1 x 0.1 and I have 251 C and 170 R.
I do not think the problem is with the display, exactly. Whatever scale I try to view the file in I see the same repeating pattern. Please see attached for the Irish Sea (with unique values as symbology).
We've been doing a little digging with other versions of ArcMap (10.3) and the raster rescale works correctly in that version however, when we move it to a PC running version 10.2 it does not display correctly so it seems to be related to the problems with 10.2's raster calculator functions/inability to 'see' rectangular raster cells. I think I need to move up a version!
I think I would have made points from the original input and then just re-gridded them using Natural Neighbour interp into square pixels.
The ration of X to Y will be a function of the projection that the data was processed in.
Why not go back to a projected coord sys for the area of interest.
To me, square pixels makes more sense than "rectangular" ones...
I may be getting this all wrong, but it makes some sense to be able to take a file, which is arranged as a sort of 'raster' to begin with and create a header so it actually is a raster, regardless of whether the cells are square or rectangular.
I've attached an original file (from the ICES climatology web section) so you can see what these look like and the accompanying readme file.
When I try to RESCALE these in 10.2 the output seems wrong. Someone has used the raster rescale function to alter these using 10.3 and it worked fine, but when I put these in 10.2 the results are wrong.
The problem is currently with ESRI as I think there may be a bug in 10.2's raster RESIZE function. I'll post what they get back to me with.
If there is no joy it'll be point data and interpolation.
If you can't get Rescale or GDAL to do what you need, the point conversion isn't particularly onerous, I've uploaded a script which converts your example file to an XYZ formatted CSV:
WIth that, you should be able to import the text directly into ArcGIS, and then right click the layer > Display XY Data to get a vector representation of it, and continue your analysis from there with the cell centers being represented by the points. You can do a variety of things from that point, including creating your correct raster, and joining against the points to assign values.
While I'm ok at running tools (once I know which one to pick) scripts are a new area for me. I've followed a few youtube tutorials and looked on the ESRI pages, but I get an error (see attached). Can you recommend a suitable link to assist with this. Sorry, I realise that this is outwith the original post, but I have 48 of these files to convert and ESRI have yet to assign the raster rescale query to one of their support team. Your script is my best hope at the moment.
The example script I posted just looked for a single file in the current directory. Here's a more robust version as a Python toolbox (requires 10.1+):
Open that in Catalog view, and you should get a toolbox with a single tool. It takes an input text file from the project and generates an output text file with X, Y, Z values, which you can use directly in the software.