4

I am trying to preprocess a netcdf dataset with arcgis such that it has the same extent, cellsize and format as an ascii dataset I am using. Both are visualized in the image below: netcdf and ascii dataset The big one in grey is the netcdf dataset, it has a longitude range of 0-360. The small dataset in Black is ascii, it has a range of -180-+180 decimal degrees. Problem is, the netcdf dataset is split right at the greenwich meridian, which splits africa, my region of interest. Now, i can change the prime meridian in the dataset to -180°, which makes the image look right, and both layers are congruent. Problem is, I want to clip the large dataset with the extent of the small dataset (rectangular), but since the minimal X is -30, the clipped image is cut exactly at 0 degrees. I tried to shift the whole dataset to the left (X-180°) but then again, it cuts off at 0°

Thanks for the help

4
  • Generally you need to crop one half and shift that, or use a projection that spans the region of interest, but how you do that depends on the software. Is arcgis part of the question, or are other options of interest?
    – mdsumner
    Commented Nov 14, 2013 at 22:26
  • yea, thats exactly what i have done many times with arcgis, but then the clipping messes up and contains only one half. I would VERY much appreciate other options. I am trying gdal_translate right now, but i'm stuck at merging the two tifs (can't get merge python script to work...) Commented Nov 14, 2013 at 22:34
  • gis.stackexchange.com/questions/37790/…
    – mdsumner
    Commented Nov 14, 2013 at 22:59
  • Thank you very much, I'm still not done testing the whole preprocessing, but I've gotten gdal_translate to work like there: eloiribeiro.wordpress.com/2009/07/08/… Since it's in portuguese I'll add a small english howto as an answer later on Commented Nov 15, 2013 at 9:37

1 Answer 1

2

I used this approach: http://eloiribeiro.wordpress.com/2009/07/08/coverter-imagens-0%C2%BA-360%C2%BA-a-180-180%C2%BA-com-gdal/ It swaps the hemispheres via gdal_translate, and therefore transforms the longitude range from 0°-360° to -180°-+180°. A quick english summary:

gdal_translate -srcwin 0 0 360 360 -a_ullr 0 90 180 -90 input output
gdal_translate -srcwin 360 0 360 360 -a_ullr -180 90 0 -90 input output

The -srcwin variables are the outer limits of the hemisphere you want to swap, the unit here is the number of cells in your source image. In my case, the left hemisphere starts in the origin with 0/0. The lower right corner is at 360/360, with 360 being half the cellcount in x direction and the entire cell count in y direction (the image has 720*360 cells). The -a_ullr coordinates are the extent of your destination (the right hemispere in this case), but this time the unit is decimal degrees. Once the images are swapped, they can be merged with gdal_merge.py, the exact input being:

python gdal_merge.py -o output input1 input2

The whole process messed with my NoData values, and I had to replace them manually with ArcPy setnull, so the images may look strange/black at first glance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.