begin f=addfile("/scratch/Greenland_bedrock_topography_V3.nc","w") projX = todouble(f->projection_x_coordinate) projY = todouble(f->projection_y_coordinate) ;we need 2D coordinate arrays for transform_coordinate() dimX = dimsizes(projX) dimY = dimsizes(projY) x2D = conform_dims((/dimX, dimY/), projX, 0) y2D = conform_dims((/dimX, dimY/), projY, 1) ; projected coordinates are presumed to be meters in proj4; we have kilometers... ;;-------------------------------------------------------------------------- ;; WRONG! File says the coordinates are in kilometers, but the values ;; are most definitely meters! ;;-------------------------------------------------------------------------- x2D = x2D ;; * 1000. y2D = y2D ;; * 1000. z2D = new(dimsizes(x2D), double) z2D = 0. ; specify the source projection... srcProj = "+proj=stere +lat_0=90 +lat_ts=71. +lon_0=-39. +ellps=WGS84" ; specifiy the target projection... tgtProj = "+proj=latlon" ; make it so... transform_coordinate(srcProj, tgtProj, x2D, y2D, z2D) print(min(x2D) + " .. " + max(x2D)) print(min(y2D) + " .. " + max(y2D)) ; generate a map to visually verify results... wks = gsn_open_wks("pdf", "greenland") mpRes = True mpRes@gsnDraw = False mpRes@gsnFrame = False map = gsn_csm_map_polar(wks, mpRes) draw(map) mkRes = True mkRes@gsMarkerIndex = 1 mkRes@gsMarkerColor = "green" gsn_polymarker(wks, map, x2D(::200,::200), y2D(::200,::200), mkRes) frame(wks) ; add the deprojected coordinates to the file... f->lon2D = x2D f->lat2D = y2D end