<div dir="ltr"><div><div><div><div>Hi,<br><br></div>Thank you for your feedback. I have made and ploted the landsea mask given at exampl 5. But, again, In example 5, it says that the mask will be suitable for 1x1 resolution and not for finer resolution. The climate model data, I am using, has .5x.5 resolution. can I use the mask for this model then? <br><br></div>Thanks for your time.<br><br></div>Best regards,<br></div>Ruksana <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 20, 2015 at 4:04 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The '<a href="http://atmos.nc" rel="noreferrer" target="_blank">atmos.nc</a>' contains<br>
<br>
Variable: oro<br>
<span class="">Number of Dimensions: 2<br>
Dimensions and sizes: [lat | 64] x [lon | 128]<br>
<br>
</span>Your data set has dimensions<br>
<span class=""><br>
x_2 = 209 ;<br>
y_2 = 146 ;<br>
<br>
</span>Two completely different resolutions ..... The 'mask' function<br>
documentation states that the array sizes must match<br>
<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/mask.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/mask.shtml</a><br>
<br>
Obviously, they don't match ... hence the error message.<br>
<span class=""> fatal:mask: dimension sizes of parameter 0 and parameter 1 do not match<br>
</span>=====<br>
<br>
DId you look at the 'Applications' page? You can create a reasonably<br>
good mask for your data sets via<br>
<br>
<a href="http://www.ncl.ucar.edu/Applications/mask.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Applications/mask.shtml</a><br>
See Example 5<br>
<br>
Good luck<br>
<div><div class="h5"><br>
On Fri, Nov 20, 2015 at 6:59 AM, Ruksana Abedin<br>
<<a href="mailto:ruksana.abedin@gmail.com">ruksana.abedin@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I need to mask the ocean data from my model data of temperature to see<br>
> temperatures on land only and compare that with APHRODITES later.<br>
><br>
> I tried to mask with oro from atmos file given at ncl website. Problem is<br>
> Field16 (temperature) is 4D and oro is 2D. What can be solution for this<br>
> problem? Can I alternatively use any other mask array for this case?<br>
><br>
> Please help me to solve this problem.<br>
><br>
> Current output map is attached.<br>
><br>
> Giving below the file details:<br>
><br>
> ncdump -h <a href="http://wah2_sas_1985_2007.part.seasmean.temp.nc" rel="noreferrer" target="_blank">wah2_sas_1985_2007.part.seasmean.temp.nc</a><br>
><br>
> netcdf wah2_sas_1985_2007.part.seasmean.temp {<br>
> dimensions:<br>
> x = 209 ;<br>
> y = 145 ;<br>
> x_2 = 209 ;<br>
> y_2 = 146 ;<br>
> z0 = 1 ;<br>
> z1 = 1 ;<br>
> z2 = 1 ;<br>
> time0 = UNLIMITED ; // (1 currently)<br>
> variables:<br>
> float global_longitude0(y, x) ;<br>
> global_longitude0:standard_name = "longitude" ;<br>
> global_longitude0:long_name = "longitude" ;<br>
> global_longitude0:units = "degrees_east" ;<br>
> global_longitude0:_CoordinateAxisType = "Lon" ;<br>
> float global_latitude0(y, x) ;<br>
> global_latitude0:standard_name = "latitude" ;<br>
> global_latitude0:long_name = "latitude" ;<br>
> global_latitude0:units = "degrees_north" ;<br>
> global_latitude0:_CoordinateAxisType = "Lat" ;<br>
> float global_longitude1(y_2, x_2) ;<br>
> global_longitude1:standard_name = "longitude" ;<br>
> global_longitude1:long_name = "longitude" ;<br>
> global_longitude1:units = "degrees_east" ;<br>
> global_longitude1:_CoordinateAxisType = "Lon" ;<br>
> float global_latitude1(y_2, x_2) ;<br>
> global_latitude1:standard_name = "latitude" ;<br>
> global_latitude1:long_name = "latitude" ;<br>
> global_latitude1:units = "degrees_north" ;<br>
> global_latitude1:_CoordinateAxisType = "Lat" ;<br>
> float z0(z0) ;<br>
> z0:standard_name = "height" ;<br>
> z0:units = "m" ;<br>
> z0:positive = "up" ;<br>
> z0:axis = "Z" ;<br>
> float z1(z1) ;<br>
> z1:standard_name = "height" ;<br>
> z1:units = "m" ;<br>
> z1:positive = "up" ;<br>
> z1:axis = "Z" ;<br>
> float z2(z2) ;<br>
> z2:standard_name = "air_pressure" ;<br>
> z2:units = "hPa" ;<br>
> z2:positive = "down" ;<br>
> z2:axis = "Z" ;<br>
> double time0(time0) ;<br>
> time0:standard_name = "time" ;<br>
> time0:units = "days since 1959-12-01 00:00:00" ;<br>
> time0:calendar = "360_day" ;<br>
> float field48(time0, z0, y, x) ;<br>
> field48:standard_name = "eastward_wind" ;<br>
> field48:long_name = "10 METRE WIND U-COMP" ;<br>
> field48:units = "m s-1" ;<br>
> field48:coordinates = "global_longitude0 global_latitude0" ;<br>
> field48:_FillValue = -1.073742e+09f ;<br>
> field48:stash_item = "225" ;<br>
> field48:stash_section = "3" ;<br>
> field48:field_code = "56" ;<br>
> field48:cell_method = "time: mean " ;<br>
> float field49(time0, z0, y, x) ;<br>
> field49:standard_name = "northward_wind" ;<br>
> field49:long_name = "10 METRE WIND V-COMP" ;<br>
> field49:units = "m s-1" ;<br>
> field49:coordinates = "global_longitude0 global_latitude0" ;<br>
> field49:_FillValue = -1.073742e+09f ;<br>
> field49:stash_item = "226" ;<br>
> field49:stash_section = "3" ;<br>
> field49:field_code = "57" ;<br>
> field49:cell_method = "time: mean " ;<br>
> float field16(time0, z0, y_2, x_2) ;<br>
> field16:standard_name = "air_temperature" ;<br>
> field16:long_name = "TEMPERATURE AT 1.5M" ;<br>
> field16:units = "K" ;<br>
> field16:coordinates = "global_longitude1 global_latitude1" ;<br>
> field16:_FillValue = -1.073742e+09f ;<br>
> field16:stash_item = "236" ;<br>
> field16:stash_section = "3" ;<br>
> field16:field_code = "16" ;<br>
> field16:cell_method = "time: maximum " ;<br>
> float field16_1(time0, z0, y_2, x_2) ;<br>
> field16_1:standard_name = "air_temperature" ;<br>
> field16_1:long_name = "TEMPERATURE AT 1.5M" ;<br>
> field16_1:units = "K" ;<br>
> field16_1:coordinates = "global_longitude1 global_latitude1"<br>
> ;<br>
> field16_1:_FillValue = -1.073742e+09f ;<br>
> field16_1:stash_item = "236" ;<br>
> field16_1:stash_section = "3" ;<br>
> field16_1:field_code = "16" ;<br>
> field16_1:cell_method = "time: minimum " ;<br>
> float field90(time0, z1, y_2, x_2) ;<br>
> field90:standard_name = "precipitation_flux" ;<br>
> field90:long_name = "TOTAL PRECIPITATION RATE KG/M2/S" ;<br>
> field90:units = "kg m-2 s-1" ;<br>
> field90:coordinates = "global_longitude1 global_latitude1" ;<br>
> field90:_FillValue = -1.073742e+09f ;<br>
> field90:stash_item = "216" ;<br>
> field90:stash_section = "5" ;<br>
> field90:field_code = "90" ;<br>
> field90:cell_method = "time: mean " ;<br>
> float field93(time0, z1, y_2, x_2) ;<br>
> field93:standard_name = "snowfall_amount" ;<br>
> field93:long_name = "SNOW MASS AFTER HYDROLOGY KG/M2" ;<br>
> field93:units = "kg m-2" ;<br>
> field93:coordinates = "global_longitude1 global_latitude1" ;<br>
> field93:_FillValue = -1.073742e+09f ;<br>
> field93:stash_item = "23" ;<br>
> field93:stash_section = "8" ;<br>
> field93:field_code = "93" ;<br>
> field93:cell_method = "time: mean " ;<br>
> float field1532(time0, z1, y_2, x_2) ;<br>
> field1532:standard_name = "surface_runoff_flux" ;<br>
> field1532:long_name = "SURFACE RUNOFF RATE KG/M2/S" ;<br>
> field1532:units = "kg m-2 s-1" ;<br>
> field1532:coordinates = "global_longitude1 global_latitude1"<br>
> ;<br>
> field1532:_FillValue = -1.073742e+09f ;<br>
> field1532:stash_item = "234" ;<br>
> field1532:stash_section = "8" ;<br>
> field1532:field_code = "1532" ;<br>
> field1532:cell_method = "time: mean " ;<br>
> float field1(time0, z2, y_2, x_2) ;<br>
> field1:standard_name = "geopotential_height" ;<br>
> field1:long_name = "GEOPOTENTIAL HEIGHT: PRESSURE LEVELS" ;<br>
> field1:units = "m" ;<br>
> field1:coordinates = "global_longitude1 global_latitude1" ;<br>
> field1:_FillValue = -1.073742e+09f ;<br>
> field1:stash_item = "202" ;<br>
> field1:stash_section = "16" ;<br>
> field1:field_code = "1" ;<br>
> field1:cell_method = "time: mean " ;<br>
><br>
> // global attributes:<br>
> :CDI = "Climate Data Interface version 1.6.0<br>
> (<a href="http://code.zmaw.de/projects/cdi" rel="noreferrer" target="_blank">http://code.zmaw.de/projects/cdi</a>)" ;<br>
> :Conventions = "CF-1.3" ;<br>
> :history = "Tue Nov 10 15:58:38 2015: cdo timmean<br>
> -selmon,6/9 <a href="http://wah2_sas_1985_2007.part.nc" rel="noreferrer" target="_blank">wah2_sas_1985_2007.part.nc</a><br>
> <a href="http://wah2_sas_1985_2007.part.seasmean.temp.nc" rel="noreferrer" target="_blank">wah2_sas_1985_2007.part.seasmean.temp.nc</a>\n",<br>
> "Mon Nov 09 12:02:27 2015: cdo mergetime<br>
> <a href="http://wah2_sas_ga.pdi.1985.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdi.1985.nc</a> <a href="http://wah2_sas_1987_p2.nc" rel="noreferrer" target="_blank">wah2_sas_1987_p2.nc</a> <a href="http://wah2_sas_ga.pdj.1991.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdj.1991.nc</a><br>
> <a href="http://wah2_sas_ga.pdj.1992.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdj.1992.nc</a> <a href="http://wah2_sas_1994_p2.nc" rel="noreferrer" target="_blank">wah2_sas_1994_p2.nc</a> <a href="http://wah2_sas_ga.pdj.1995.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdj.1995.nc</a><br>
> <a href="http://wah2_sas_ga.pdj.1996.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdj.1996.nc</a> <a href="http://wah2_sas_ga.pdj.1997.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdj.1997.nc</a> <a href="http://wah2_sas_ga.pdj.1998.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdj.1998.nc</a><br>
> <a href="http://wah2_sas_ga.pdk.2000.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdk.2000.nc</a> <a href="http://wah2_sas_ga.pdk.2001.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdk.2001.nc</a> <a href="http://wah2_sas_ga.pdk.2002.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdk.2002.nc</a><br>
> <a href="http://wah2_sas_ga.pdk.2003.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdk.2003.nc</a> <a href="http://wah2_sas_ga.pdk.2004.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdk.2004.nc</a> <a href="http://wah2_sas_ga.pdk.2005.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdk.2005.nc</a><br>
> <a href="http://wah2_sas_ga.pdk.2006.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdk.2006.nc</a> <a href="http://wah2_sas_1985_2007.part.nc" rel="noreferrer" target="_blank">wah2_sas_1985_2007.part.nc</a>\n",<br>
> "Fri Oct 23 12:59:32 2015: cdo mergetime<br>
> <a href="http://0049ga.pdk6dec.nc" rel="noreferrer" target="_blank">0049ga.pdk6dec.nc</a> <a href="http://0049ga.pdk7jan.nc" rel="noreferrer" target="_blank">0049ga.pdk7jan.nc</a> <a href="http://0049ga.pdk7feb.nc" rel="noreferrer" target="_blank">0049ga.pdk7feb.nc</a> <a href="http://0049ga.pdk7mar.nc" rel="noreferrer" target="_blank">0049ga.pdk7mar.nc</a><br>
> <a href="http://0049ga.pdk7apr.nc" rel="noreferrer" target="_blank">0049ga.pdk7apr.nc</a> <a href="http://0049ga.pdk7may.nc" rel="noreferrer" target="_blank">0049ga.pdk7may.nc</a> <a href="http://0049ga.pdk7jun.nc" rel="noreferrer" target="_blank">0049ga.pdk7jun.nc</a> <a href="http://0049ga.pdk7jul.nc" rel="noreferrer" target="_blank">0049ga.pdk7jul.nc</a><br>
> <a href="http://0049ga.pdk7aug.nc" rel="noreferrer" target="_blank">0049ga.pdk7aug.nc</a> <a href="http://0049ga.pdk7sep.nc" rel="noreferrer" target="_blank">0049ga.pdk7sep.nc</a> <a href="http://0049ga.pdk7oct.nc" rel="noreferrer" target="_blank">0049ga.pdk7oct.nc</a> <a href="http://0049ga.pdk7nov.nc" rel="noreferrer" target="_blank">0049ga.pdk7nov.nc</a><br>
> <a href="http://wah2_sas_ga.pdk.2006.nc" rel="noreferrer" target="_blank">wah2_sas_ga.pdk.2006.nc</a>" ;<br>
> :alpham = 0.5f ;<br>
> :CDO = "Climate Data Operators version 1.6.0<br>
> (<a href="http://code.zmaw.de/projects/cdo" rel="noreferrer" target="_blank">http://code.zmaw.de/projects/cdo</a>)" ;<br>
><br>
><br>
> while,<br>
><br>
> Variable: oro<br>
> Type: float<br>
> Total Size: 32768 bytes<br>
> 8192 values<br>
> Number of Dimensions: 2<br>
> Dimensions and sizes: [lat | 64] x [lon | 128]<br>
> Coordinates:<br>
> lat: [-87.8638..87.8638]<br>
> lon: [ 0..357.1875]<br>
> Number Of Attributes: 2<br>
> time : 791<br>
> long_name : ocean (0), land (1), sea ice (2) flag<br>
> The script I used is:<br>
><br>
> ;*********************************<br>
> ;<br>
> ;**********************************<br>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/popRemap.ncl"<br>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/calendar_decode2.ncl"<br>
> ;************************************************<br>
><br>
> begin<br>
><br>
> ; read in data<br>
><br>
> f=addfile<br>
> ("/ouce-home/students/rege1218/WAH2_SAS_Results_1985_2011/<a href="http://wah2_sas_1985_2007.part.seasmean.temp.nc" rel="noreferrer" target="_blank">wah2_sas_1985_2007.part.seasmean.temp.nc</a>",<br>
> "r");<br>
> f1=addfile("/ouce-home/students/rege1218/WAH2_SAS_Results_1985_2011/<a href="http://atmos.nc" rel="noreferrer" target="_blank">atmos.nc</a>","r")<br>
><br>
> temp_mod1 = f->field16<br>
> temp_mod1 = temp_mod1 - 273.15 ; Convert Kelvin -> Celsius<br>
><br>
> temp_mod2 = f->field16_1<br>
> temp_mod2 = temp_mod2 - 273.15 ; Convert Kelvin -> Celsius<br>
><br>
> temp_mod = (temp_mod1+temp_mod2)/2<br>
> time = f->time0<br>
> lat2d = f->global_latitude1 ;0<br>
> lon2d = f->global_longitude1 ;0<br>
> ;lat = f->latitude1<br>
> ;lon = f->longitude1<br>
><br>
> temp_mod!0 = "time"<br>
> temp_mod!1 = "surface"<br>
> temp_mod!2 = "lat"<br>
> temp_mod!3 = "lon"<br>
> temp_mod@units = "(C)" ; Change units to reflect.<br>
> temp_mod@lat2d = lat2d<br>
> temp_mod@lon2d = lon2d<br>
><br>
> temp_mod = temp_mod(0,0,:,:)<br>
> oro = f1->ORO(0,:,:)<br>
><br>
> printVarSummary(temp_mod)<br>
> printVarSummary(oro)<br>
><br>
> ;***********************************************************<br>
> ; use mask function to mask out land then ocean data<br>
> ; ocean=0, land=1, sea_ice=2<br>
> ;***********************************************************<br>
> land_only = temp_mod ;trick to keep cv's and atts<br>
> ocean_only = temp_mod<br>
><br>
><br>
> land_only = mask(temp_mod, oro,1) ; Return the values of temp_mod where<br>
> oro=1<br>
> ocean_only = mask(temp_mod, oro,0) ; Return the values of temp_mod where<br>
> oro=0<br>
><br>
> ;***********************************************************<br>
> ; create plots<br>
> ;***********************************************************<br>
><br>
> wks = gsn_open_wks("eps","temp1")<br>
> gsn_define_colormap(wks,"hotcolr_19lev") ; choose colormap<br>
> ;gsn_reverse_colormap(wks)<br>
> res = True<br>
> res@cnFillOn = True ; turn on color<br>
> res@cnLinesOn = False ; turn off contour lines<br>
> res@cnLevelSpacingF = 0.10 ; contour interval<br>
> res@cnFillDrawOrder = "PreDraw" ; draw contours first<br>
> res@lbLabelStride = 2 ; stride on label bar<br>
> res@gsnSpreadColors = True ; use full colormap<br>
> res@gsnSpreadColorEnd = -3 ; -3 don't use land color<br>
> res@gsnAddCyclic = False ; regional data<br>
> res@gsnLeftString = ""<br>
> res@tiMainString = ""<br>
> res@gsnRightString = ""<br>
> ;res@mpProjection = "LambertConformal"<br>
> ;res@gsnMaskLambertConformal = True<br>
> res@mpMaxLatF = 60;max(lat) ; zoom in on region<br>
> res@mpMinLatF = -30;min(lat)<br>
> res@mpMinLonF = 0;min(lon)<br>
> res@mpMaxLonF = 130; max(lon)<br>
> res@mpCenterLonF = 10 ; def is zero<br>
> res@mpLandFillColor = "Transparent"<br>
> res@cnLevelSelectionMode= "ManualLevels"<br>
> res@cnMinLevelValF = -4.00<br>
> res@cnMaxLevelValF = 48.00 ;2<br>
> res@cnLevelSpacingF = 2 ;2<br>
> res@lbLabelAutoStride = True<br>
> temp_mod@_FillValue = 0.0<br>
> temp_mod@_FillValue = -999<br>
><br>
> plot_test = gsn_csm_contour_map(wks,land_only(0,0,:,:),res)<br>
><br>
><br>
> end<br>
><br>
> error I got:<br>
><br>
> fatal:mask: dimension sizes of parameter 0 and parameter 1 do not match<br>
> fatal:Execute: Error occurred at or near line 54 in file<br>
> Correctred_wah2_sas_seasonalmean_temp_1985_2007_part.ncl<br>
><br>
><br>
> Thank you,<br>
> Ruksana<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> ncl-talk mailing list<br>
> <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
><br>
</blockquote></div><br></div>