Notes on steps taken to create Greenland_5km_v1.1_SacksRev_c110629.nc from Greenland_5km_v1.1.nc Bill Sacks (wsacks@gmail.com) June 29, 2011 The new file is identical to the old one except in the landcover variable: Modified landcover to have value 0 [no_data] in some places where it used to have value 1 [ocean], because some grid cells were incorrectly classified as ocean (e.g., over Ellesmere Island); however, the method for doing this means that many true ocean points are now classified as no_data. Note that the scripts fill_greenland.ncl and interpolate_greenland.ncl can be found here: https://svn-user-sacks.cgd.ucar.edu/cism_misc/fixing_greenland_data/trunk --- Creating greenland mask map: ncks -d latitude,58.,85. -d longitude,-93.,11. ~/from_glacier/political_masks/gl_ad0_5min.nc gl_ad0_5min_subset.nc In R: Created mask equal to 1 over greenland, 0 over other countries: > map <- read.ncdf('gl_ad0_5min_subset.nc') > map$mask <- map$adminX_5min > w <- which(map$adminX_5min$data != 1) > map$mask$data[w] <- 0 > length(w) [1] 64123 > write.ncdf('greenland_mask.nc', map) Then removed degenerate dimensions: ncwa -O -a level greenland_mask.nc greenland_mask.nc ncwa -O -a time greenland_mask.nc greenland_mask.nc --- Then extrapolated to greenland_mask_extrap.nc with the following; this gives interpolated / extrapolated values of the mask in the ocean: ncl fill_greenland.ncl and reversed latitude with: ncpdq -O -a -latitude greenland_mask_extrap.nc greenland_mask_extrap.nc --- Did the following pre-processing of the original Greenland data: Removed degenerate time dimension and just output lat & lon variables: ncwa -O -a time -v lat,lon Greenland_5km_v1.1.nc Greenland_5km_v1.1_latlon_notime.nc ---- Then did the regridding: Regridded mask to 5km resolution: ncl interpolate_greenland.ncl ncrename -d ncl0,y1 -d ncl1,x1 greenland_mask_5km.nc ncks -A -v lat,y1,lon,x1 Greenland_5km_v1.1_latlon_notime.nc greenland_mask_5km.nc Added degenerate time dimension: ncecat -O greenland_mask_5km.nc greenland_mask_5km.nc ncrename -d record,time greenland_mask_5km.nc ---- Then used the mask to modify the landcover value: for points classified as ocean (landcover=1) that are relatively far from Greenland (mask_greenland < 0.666667), reclassify them as nodata (landcover=0): cp Greenland_5km_v1.1.nc Greenland_5km_v1.2.nc ncks -A -v mask greenland_mask_5km.nc Greenland_5km_v1.2.nc ncrename -v mask,mask_greenland Greenland_5km_v1.2.nc ncap2 -O -s 'where(mask_greenland<0.666667 && landcover==1) landcover=0;' Greenland_5km_v1.2.nc Greenland_5km_v1.2.nc ncks -O -x -v mask_greenland Greenland_5km_v1.2.nc Greenland_5km_v1.2.nc --- Then added a note to the file: ncatted -h -a note,landcover,c,c,'Bill Sacks (wsacks@gmail.com) (6-29-11): Modified landcover to have value 0 [no_data] in some places where it used to have value 1 [ocean], because some grid cells were incorrectly classified as ocean (e.g., over Ellesmere Island); however, the method for doing this means that many true ocean points are now classified as no_data' Greenland_5km_v1.2.nc ----- 10-3-11: To avoid name conflicts (because the original data creators may be producing their own v. 1.2 of the data), I am renaming this file from Greenland_5km_v1.2.nc to Greenland_5km_v1.1_SacksRev_c110629.nc.