<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Good morning,<div class=""><br class=""></div><div class="">I created spatial subsets from MACAv2 downscaled climate projections for the continental US (CONUS), however, the subsetted files have the same file as the originals (ca. 1.5 GB), even though the subset area only covers about half of CONUS (I checked). I couldn’t attach the files, but I attached the NCL script below. The NCL script I use is adapted from one I used to create subsets of vegetation projections for which the file size afterwards was about half, as one would expect. Does anyone have ideas for why the size isn’t reduced? Is the original MACAv2 data somehow compressed and gets uncompressed in the process? Any advice is much appreciated.</div><div class=""><br class=""></div><div class="">Thank you very much!</div><div class=""><br class=""></div><div class="">Best,</div><div class="">Toni</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""><br class=""></div><div class=""><span style="font-family: Courier;" class="">; ---------------------------------------------------</span></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</font></div><div class=""><font face="Courier" class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</font></div><div class=""><font face="Courier" class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">; ---------------------------------------------------</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">begin</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">RCP_in_list = [/"rcp45","rcp85"/]</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">RCP_out_list = [/"rcp_45","rcp_85"/]</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">model_list = [/"CCSM4","GFDL-ESM2M","HadGEM2-ES365","IPSL-CM5A-LR","MRI-CGCM3"/]</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">variable_list = [/"ppt","tdmean","tmax","tmin"/]</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">do h = 0, ListCount(RCP_in_list) - 1 </font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> do j = 0, ListCount(model_list) - 1 </font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> do k = 0, ListCount(variable_list) - 1 </font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> ; ***********************************************</font></div><div class=""><font face="Courier" class=""> ; READ IN MACA FILE</font></div><div class=""><font face="Courier" class=""> ; ***********************************************</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> print("1 - Read in " + RCP_in_list[h](0) + "/" + model_list[j](0) + "/" + variable_list[k](0) + ".nc")</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> MACA_f = addfile("~/NIFA/MACAv2/MACA_" + RCP_in_list[h](0) + "/" + model_list[j](0) + "/" + variable_list[k](0) + ".nc", "r")</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> ; ***********************************************</font></div><div class=""><font face="Courier" class=""> ; READ IN VARIABLES</font></div><div class=""><font face="Courier" class=""> ; ***********************************************</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> print("2 - Read in variable")</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> if(variable_list[k](0) .eq. "ppt") then</font></div><div class=""><font face="Courier" class=""> <span class="Apple-tab-span" style="white-space:pre"> </span>variable = MACA_f->ppt(:,:,:)</font></div><div class=""><font face="Courier" class=""> end if</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> if(variable_list[k](0) .eq. "tdmean") then</font></div><div class=""><font face="Courier" class=""> <span class="Apple-tab-span" style="white-space:pre"> </span>variable = MACA_f->tdmean(:,:,:)</font></div><div class=""><font face="Courier" class=""> end if</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> if(variable_list[k](0) .eq. "tmax") then</font></div><div class=""><font face="Courier" class=""> <span class="Apple-tab-span" style="white-space:pre"> </span>variable = MACA_f->tmax(:,:,:)</font></div><div class=""><font face="Courier" class=""> end if</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> if(variable_list[k](0) .eq. "tmin") then</font></div><div class=""><font face="Courier" class=""> <span class="Apple-tab-span" style="white-space:pre"> </span>variable = MACA_f->tmin(:,:,:)</font></div><div class=""><font face="Courier" class=""> end if</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> lat = MACA_f->lat</font></div><div class=""><font face="Courier" class=""> lon = MACA_f->lon</font></div><div class=""><font face="Courier" class=""> time = MACA_f->time</font></div><div class=""><font face="Courier" class=""> description = variable@long_name</font></div><div class=""><font face="Courier" class=""> </font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> ; ***********************************************</font></div><div class=""><font face="Courier" class=""> ; CREATE US-SUBSET OF THE GLOBAL DATA</font></div><div class=""><font face="Courier" class=""> ; ***********************************************</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> print("3 - Create lat/lon subset")</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> ; let's choose latitudes of </font></div><div class=""><font face="Courier" class=""> latind = (/25,50/)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> ; let's choose longitudes of </font></div><div class=""><font face="Courier" class=""> lonind = (/-118,-92/)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> lti = ind_nearest_coord(latind,lat,0) ; lti, lni = variables, ind_nearest_coord = pre-defined functions to determine the indices of locations closest to the coordinate array, needed later to define var_subdomain_3D</font></div><div class=""><font face="Courier" class=""> lni = ind_nearest_coord(lonind,lon,0)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> lat_subdomain = lat(lti(0):lti(1))</font></div><div class=""><font face="Courier" class=""> lon_subdomain = lon(lni(0):lni(1))</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> var_subdomain_3D = variable(:,lti(0):lti(1),lni(0):lni(1)) ; define the subdomain based on latind and lonind</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> ; ***********************************************</font></div><div class=""><font face="Courier" class=""> ; 3 - WRITE THE SUBSET INTO NEW netCDF FILE</font></div><div class=""><font face="Courier" class=""> ; ***********************************************</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> print("4 - Write subset into new netCDF file")</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> netCDF1 = True ; Output format is NetCDF</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> if (netCDF1) then</font></div><div class=""><font face="Courier" class=""> diro = "~/NIFA/MACAv2/subset_lat_lon/" + RCP_out_list[h](0) + "/" + model_list[j](0) + "/"</font></div><div class=""><font face="Courier" class=""> filo = variable_list[k](0) + "_lat_lon.nc"</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> end if</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> setfileoption("nc","Format","LargeFile")</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> if (netCDF1) then</font></div><div class=""><font face="Courier" class=""> system("/bin/rm -f "+ diro + filo) ; removes old files with the same name if they are present</font></div><div class=""><font face="Courier" class=""> ncdf = addfile(diro + filo,"c")</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> setfileoption(ncdf,"DefineMode",True)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> ; create attributes</font></div><div class=""><font face="Courier" class=""> fAtt = True</font></div><div class=""><font face="Courier" class=""> fAtt@title = "MACAv2 data, RCP: " + RCP_out_list[h](0) + " Climate model: " + model_list[j](0) + " Variable: " + variable_list[k](0)</font></div><div class=""><font face="Courier" class=""> fAtt@description = description</font></div><div class=""><font face="Courier" class=""> fAtt@Conventions = "None"</font></div><div class=""><font face="Courier" class=""> fAtt@creation_date = systemfunc("date")</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> fileattdef(ncdf,fAtt)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> dimNames = (/"time","lat","lon"/)</font></div><div class=""><font face="Courier" class=""> dimSizes = (/dimsizes(time),dimsizes(lat_subdomain),dimsizes(lon_subdomain)/)</font></div><div class=""><font face="Courier" class=""> dimUnlim = (/True,False,False/)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> filedimdef(ncdf,dimNames,dimSizes,dimUnlim)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> filevardef(ncdf,"time",typeof(time),(/"time"/))</font></div><div class=""><font face="Courier" class=""> filevardef(ncdf,"lat",typeof(lat_subdomain),(/"lat"/))</font></div><div class=""><font face="Courier" class=""> filevardef(ncdf,"lon",typeof(lon_subdomain),(/"lon"/))</font></div><div class=""><font face="Courier" class=""> filevardef(ncdf,"var",typeof(var_subdomain_3D),(/"time","lat","lon"/))</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> ; now write all the variables to the file</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> ncdf->time = (time)</font></div><div class=""><font face="Courier" class=""> ncdf->lat = (lat_subdomain)</font></div><div class=""><font face="Courier" class=""> ncdf->lon = (lon_subdomain)</font></div><div class=""><font face="Courier" class=""> ncdf->var = (var_subdomain_3D)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> end if</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> print("**** DONE ****")</font></div><div class=""><font face="Courier" class=""> print("")</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> delete([/variable,var_subdomain_3D,lat,lon/])</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> end do ; end variable list loop</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""> end do ; end model list loop</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">end do ; end RCP list loop</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">end</font></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Calibri" class=""><br class=""></font></div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Calibri" class=""><b class="">Toni Klemm, Ph.D.<br class=""></b>Postdoctoral Research Associate</font></div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Department of Ecosystem Science and Management</div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">College of Agriculture and Life Sciences</div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Texas A&M University, College Station, TX</div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Calibri" class="">Contributor to the <a href="http://www.eccforum.org" class="">Early Career Climate Forum</a><br class=""><a href="http://www.toni-klemm.de" class="">www.toni-klemm.de</a> | <a href="http://twitter.com/toniklemm" class="">@toniklemm</a></font></div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Calibri" class=""><br class=""></font></div><div style="color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Calibri" class=""><br class=""></font></div></div></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br class=""></div></body></html>