<html><body><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"><div>Just a guess: The error might be due to<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><!--StartFragment--><span style="color: rgb(0, 0, 255);" data-mce-style="color: #0000ff;">dF_toa=>p1 1 t,x,y,e  p1</span><!--EndFragment--> </div><div><br data-mce-bogus="1"></div><div>and<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div> <!--StartFragment-->        <span style="color: rgb(0, 0, 255);" data-mce-style="color: #0000ff;">double dF_toa(dX, sw_lw, up_down, all_clear, hour, latitude, longitude, time) ;</span><br><!--EndFragment--> </div><div><br data-mce-bogus="1"></div><div>array shape/size mismatch.. ?<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Regards,<br data-mce-bogus="1"></div><div>Mahakur<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>From: </b>"Hailan Wang" <hailanw@gmail.com><br><b>To: </b>"GrADS Users Forum" <gradsusr@gradsusr.org><br><b>Sent: </b>Tuesday, September 25, 2018 7:55:33 PM<br><b>Subject: </b>[gradsusr] How to write a GrADS data descriptor (.ctl) file for NetCDF files with variables of multiple (>4) dimensions<br></div><div><br></div><div data-marker="__QUOTED_TEXT__"><div dir="ltr"><div dir="ltr">Dear all,<br><br>I am wondering if you have any suggestions on how to open and read NetCDF files with variables of multiple dimensions (# of dimension > 4). Please see below for an example of such NetCDF file (CldAll.nc):<br><br>netcdf CldAll {<br>dimensions:<br>        sw_lw = 2 ;<br>        up_down = 2 ;<br>        time = UNLIMITED ; // (1 currently)<br>        all_clear = 2 ;<br>        latitude = 90 ;<br>        longitude = 72 ;<br>        pressure_level = 30 ;<br>        hour = 8 ;<br>        dX = 1 ;<br>        aer_wavelength = 1 ;<br>        aer_type = 7 ;<br>        pressure_layer = 29 ;<br>        cloud_condition = 12 ;<br>variables:<br>        int time(time) ;<br>                time:long_name = "Time in UNIX" ;<br>                time:units = "Seconds since 1970-1-1 0:00:00 0:00" ;<br>                time:comment = "15th day of the month" ;<br>        float pressure_level(pressure_level) ;<br>                pressure_level:long_name = "Level Pressure" ;<br>                pressure_level:units = "mb" ;<br>        float latitude(latitude) ;<br>                latitude:long_name = "Latitude" ;<br>                latitude:units = "degrees north" ;<br>        float longitude(longitude) ;<br>                longitude:long_name = "Longitude" ;<br>                longitude:units = "degrees east" ;<br>        double sfc_pressure(hour, latitude, longitude, time) ;<br>                sfc_pressure:long_name = "Surface pressure" ;<br>                sfc_pressure:units = "mb" ;<br>        float hour(hour) ;<br>                hour:units = "UTC" ;<br>                hour:comment = ">=0 -> UTC hour; =-1 -> single mean value; =-2 -> daytime mean; =-3 -> nighttime mean;" ;<br>                hour:long_name = "Hour" ;<br>        double dF_toa(dX, sw_lw, up_down, all_clear, hour, latitude, longitude, time) ;<br>                dF_toa:_FillValue = -9999. ;<br>                dF_toa:long_name = "Partial derivative of the flux at the top of the atmosphere" ;<br>                dF_toa:units = "W/m^2" ;<br>        double dF_sfc(dX, sw_lw, up_down, all_clear, hour, latitude, longitude, time) ;<br>                dF_sfc:_FillValue = -9999. ;<br>                dF_sfc:long_name = "Partial derivative of the flux at the surface" ;<br>                dF_sfc:units = "W/m^2" ;<br>        double dX01_aer_tau(aer_wavelength, aer_type, latitude, longitude, time) ;<br>                dX01_aer_tau:_FillValue = -9999. ;<br>                dX01_aer_tau:long_name = "Partial derivative of the aerosol optical depth" ;<br>                dX01_aer_tau:units = "unitless" ;<br>        double dX01_aer_vertdist(aer_type, pressure_layer, latitude, longitude, time) ;<br>                dX01_aer_vertdist:_FillValue = -9999. ;<br>                dX01_aer_vertdist:long_name = "Partial derivative of the aerosol vertical distribution" ;<br>                dX01_aer_vertdist:units = "percent" ;<br>                dX01_aer_vertdist:comment = "Fraction of aer_tau in each layer" ;<br>        double dX01_aer_vertdist_sfc(aer_type, latitude, longitude, time) ;<br>                dX01_aer_vertdist_sfc:_FillValue = -9999. ;<br>                dX01_aer_vertdist_sfc:long_name = "Partial derivative of the aerosol vertical distribution in the layer adjacent to the surface" ;<br>                dX01_aer_vertdist_sfc:units = "percent" ;<br>                dX01_aer_vertdist_sfc:comment = "Fraction of aer_tau in the layer adjacent to the surface" ;<br>        double dX01_aer_rh(pressure_level, latitude, longitude, time) ;<br>                dX01_aer_rh:_FillValue = -9999. ;<br>                dX01_aer_rh:long_name = "Partial derivative of the relative humidity for computing aerosol ssps" ;<br>                dX01_aer_rh:units = "%" ;<br>        double dX01_aer_sfc_rh(latitude, longitude, time) ;<br>                dX01_aer_sfc_rh:_FillValue = -9999. ;<br>                dX01_aer_sfc_rh:long_name = "Partial derivative of the surface relative humidity for computing aerosol ssps" ;<br>                dX01_aer_sfc_rh:units = "%" ;<br><br>// global attributes:<br>                :_NCProperties = "version=1|netcdflibversion=4.4.1|hdf5libversion=1.8.17" ;<br>                :cloud_condition = "=1 -> High+Thin; =2 -> High+Medium; =3 -> High+Thick; =4 -> UpperMid+Thin; =5 -> UpperMid+Medium; =6 -> UpperMid+Thick; =7 -> LowerMid+Thin; =8 -> LowerMid+Medium; =9 -> LowerMid+Thick; =10 -> Low+Thin; =11 -> Low+Medium; =12 -> Low+Thick; " ;<br>                :High = "50-300 mb" ;<br>                :UpperMid = "300-500 mb" ;<br>                :LowerMid = "500-700 mb" ;<br>                :Low = "700 mb-Surface" ;<br>                :Thin = "optical depth < 1" ;<br>                :Medium = "optical depth 1-5" ;<br>                :Thick = "optical depth > 5" ;<br>                :contact = "Tyler Thorsen (<a href="mailto:tyler.thorsen@nasa.gov" target="_blank">tyler.thorsen@nasa.gov</a>)" ;<br>                :input_Month_file = "/SCF5/ADF/tthorsen/data/hiatus/PRPIN/PRPIN-Month/CERES_PRPIN-Month_SYN3HR-GEOS3HR-MATCH-SZAGEOS3HR_Edition4_2x5/CERES_PRPIN-Month_SYN3HR-GEOS3HR-MATCH-SZAGEOS3HR_Edition4_2x5_201701.nc" ;<br>                :start_date_for_climatology = 200007 ;<br>                :end_date_for_climatology = 201706 ;<br>data:<br><br> time = 1484438400 ;<br><br> pressure_level = 1000, 950, 900, 850, 800, 750, 700, 650, 600, 550, 500,<br>    450, 400, 350, 300, 250, 200, 150, 100, 70, 50, 30, 15, 7, 4, 2, 1, 0.7,<br>    0.4, 0.1 ;<br><br> latitude = 89, 87, 85, 83, 81, 79, 77, 75, 73, 71, 69, 67, 65, 63, 61, 59,<br>    57, 55, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23,<br>    21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, -1, -3, -5, -7, -9, -11, -13, -15,<br>    -17, -19, -21, -23, -25, -27, -29, -31, -33, -35, -37, -39, -41, -43,<br>    -45, -47, -49, -51, -53, -55, -57, -59, -61, -63, -65, -67, -69, -71,<br>    -73, -75, -77, -79, -81, -83, -85, -87, -89 ;<br><br> longitude = -177.5, -172.5, -167.5, -162.5, -157.5, -152.5, -147.5, -142.5,<br>    -137.5, -132.5, -127.5, -122.5, -117.5, -112.5, -107.5, -102.5, -97.5,<br>    -92.5, -87.5, -82.5, -77.5, -72.5, -67.5, -62.5, -57.5, -52.5, -47.5,<br>    -42.5, -37.5, -32.5, -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5,<br>    12.5, 17.5, 22.5, 27.5, 32.5, 37.5, 42.5, 47.5, 52.5, 57.5, 62.5, 67.5,<br>    72.5, 77.5, 82.5, 87.5, 92.5, 97.5, 102.5, 107.5, 112.5, 117.5, 122.5,<br>    127.5, 132.5, 137.5, 142.5, 147.5, 152.5, 157.5, 162.5, 167.5, 172.5,<br>    177.5 ;<br><br> hour = 0, 3, 6, 9, 12, 15, 18, 21 ;<br>}<br></div><div dir="ltr"><br></div><div dir="ltr"><br>I cannot directly open the NetCDF file using the command "sdfopen", with the following error message:<br><br>ga-> sdfopen CldAll.nc<br>Scanning self-describing file:  CldAll.nc<br>gadsdf: SDF file has no discernable X coordinate.<br>  To open this file with GrADS, use a descriptor file with an XDEF entry.<br>  Documentation is at <a href="http://iges.org/grads/gadoc/SDFdescriptorfile.html" target="_blank">http://iges.org/grads/gadoc/SDFdescriptorfile.html</a><br></div><div dir="ltr"><br></div><div dir="ltr"><br>In order to open the NetCDF file, I need to write a GrADS data descriptor (.ctl) file for it. Here I only need to extract the sw (Shortwave) and lw (Longwave) components of "dF_toa". My current .ctl file reads:<br><br>dset ^CldAll.nc<br>title test<br>dtype netcdf<br>UNDEF -9999.<br>options yrev<br>xdef   72 linear  -177.5 5.0<br>ydef   90 linear  -89 2<br>zdef   1 linear 1 1<br>tdef   8 linear  0z1jan2001 3hr<br>edef   2 names sw lw<br>vars   1<br>dF_toa=>p1 1 t,x,y,e  p1<br>endvars<br></div><div dir="ltr"><br></div><div dir="ltr"><br>It apparently does not work – see below for the error message: <br><br>ga-> open aa.ctl<br>Scanning description file:  aa.ctl<br>Data file CldAll.nc is open as file 1<br>LON set to 0 360 <br>LAT set to -89 89 <br>LEV set to 1 1 <br>Time values set: 2001:1:1:0 2001:1:1:0 <br>E set to 1 1 <br>ga-> d p1<br>gancgrid error: nc_get_vara_double failed; NetCDF: Start+count exceeds dimension bound<br>Data Request Error:  Error for variable 'p1'<br>  Error ocurred at column 1<br>DISPLAY error:  Invalid expression <br>  Expression = p1<br><br><br>Any suggestions on how to write the .ctl file are much appreciated!<br><br>Thanks,<br>Hailan<br></div></div>
<br>_______________________________________________<br>gradsusr mailing list<br>gradsusr@gradsusr.org<br>http://gradsusr.org/mailman/listinfo/gradsusr<br></div></div></body></html>