<div dir="ltr"><div>You csn use functions/procedures but I prefer using NCL syntax:</div><div><br></div><div>See: <a href="https://www.ncl.ucar.edu/Applications/method_1.shtml"><b>https://www.ncl.ucar.edu/Applications/method_1.shtml</b></a></div><div><br></div><div>zmid(latitude,longitude,levz_mid)</div><div>========</div><div><br></div><div> work = zmid(levz_mid|:,latitude|:,longitude|:) ; reorder via NCL syntax: sizes: (klev,nlat,mlon)<br></div><div> printVarSummary(work)</div><div> print("=====")<br></div><div> <br></div><div> ntim = 1 ; 0 1 2 3<br></div><div> WORK = <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/conform_dims.shtml"><b>conform_dims</b></a>((/ntim,klev,nlat,mlon/), work, (/1,2,3/)) <br></div><div> printVarSummary(WORK) <br></div><div> print("=====")</div><div><br></div><div> copy_VarMeta(x, WORK(0,:,:,:)) ; coordinates and attributes<br></div><div> WORK!0 = "time" ; name dimension</div><div>;; WORK&time = (/...../) ; add time coordinate <br></div><div><div> printVarSummary(WORK) <br></div><div> print("=====")<br><pre> <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml"><strong>setfileoption</strong></a>("nc","Format","NetCDF4Classic") <br></pre><pre> diro = "./"<br> filo = "SampleFile_KemalGurer.nc"<br> ptho = doro+filo<br> fo = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml"><strong>addfile</strong></a>(ptho,"c")<br><br>;===================================================================<br>; create global attributes of the file (optional)
;===================================================================
fAtt = True ; assign file attributes
fAtt@title = "NCL netCDF Creation: Kemal Gurer"
fAtt@source_file = "<a href="http://original-file.nc">original-file.nc</a>"
fAtt@Conventions = "None"
fAtt@creation_date = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/systemfunc.shtml"><strong>systemfunc</strong></a> ("date")
<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/fileattdef.shtml"><strong>fileattdef</strong></a>( fo, fAtt ) ; copy file attributes
;===================================================================
; make time an <b>UNLIMITED</b> dimension; recommended for most applications
;===================================================================
<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml"><strong>filedimdef</strong></a>(fo,"time",-1,True)
;===================================================================
; output variables directly; NCL will call appropriate functions
; to write the meta data associated with each variable
;===================================================================
fo->ZMID = WORK ; 4D
<br></pre></div> ==========</div><div>After file is created, examine file contents<br></div><div><br></div><div> %> <b>ncdump</b> -h SampleFile_KemalGurer.nc</div><div><br></div><div>or <br></div><div><br></div><div> %> <b>ncl_filedump</b> SampleFile_KemalGurer.nc</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 22, 2020 at 5:28 PM Gurer, Kemal@ARB via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_3894608283972658299WordSection1">
<p class="MsoNormal">Hello,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I am writing some variables into a netcdf file, but for my problem, let me show one variable here, zmid, with the netcdf name ZH, using the following netcdf commands:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">filevardef(f,"ZH","float",(/"TSTEP","LAY","ROW","COL"/))<u></u><u></u></p>
<p class="MsoNormal">ZH_atts = 0.0<u></u><u></u></p>
<p class="MsoNormal">ZH_atts@long_name = "ZH"<u></u><u></u></p>
<p class="MsoNormal">ZH_atts@var_desc = "mid-layer height above ground"<u></u><u></u></p>
<p class="MsoNormal">ZH_atts@units = "M"<u></u><u></u></p>
<p class="MsoNormal">ZH_atts@_FillValue = 1e32<u></u><u></u></p>
<p class="MsoNormal">filevarattdef(f,"ZH",ZH_atts)<u></u><u></u></p>
<p class="MsoNormal">ZH = new((/nlev, nlat, nlon/), "float", ZH_atts@_FillValue)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">do n = 0, ntim-1<u></u><u></u></p>
<p class="MsoNormal"> f->ZH(n,:,:,:) = (/zmid/)<u></u><u></u></p>
<p class="MsoNormal">end do<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Here, TSTEP is Time, LAY is levels, ROW is latitude, and COL is longitude with the exact dimensions of the dimensions given in the original data.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">printVarSummary(zmid) gives the following information:<u></u><u></u></p>
<p class="MsoNormal">-----------------------------------------------------------------------------------<u></u><u></u></p>
<p class="MsoNormal">Variable: zmid<u></u><u></u></p>
<p class="MsoNormal">Type: float<u></u><u></u></p>
<p class="MsoNormal">Total Size: 2328480 bytes<u></u><u></u></p>
<p class="MsoNormal"> 582120 values<u></u><u></u></p>
<p class="MsoNormal">Number of Dimensions: 3<u></u><u></u></p>
<p class="MsoNormal">Dimensions and sizes: [latitude | 98] x [longitude | 108] x [levz_mid | 55]<u></u><u></u></p>
<p class="MsoNormal">Coordinates:<u></u><u></u></p>
<p class="MsoNormal"> latitude: [31.6178..42.50189]<u></u><u></u></p>
<p class="MsoNormal"> longitude: [-129.0292..-113.0208]<u></u><u></u></p>
<p class="MsoNormal">Number Of Attributes: 2<u></u><u></u></p>
<p class="MsoNormal"> units : m MSL<u></u><u></u></p>
<p class="MsoNormal"> long_name : Geometric height of mid-levels<u></u><u></u></p>
<p class="MsoNormal">(0)<u></u><u></u></p>
<p class="MsoNormal">(0) Geometric height of mid-levels (m MSL) : min=-64.3161 max=29608.8<u></u><u></u></p>
<p class="MsoNormal">-----------------------------------------------------------------------------------<u></u><u></u></p>
<p class="MsoNormal">Since I need to write the variable “zmid” as well as other variables into the netcdf file with the following order of dimensions:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">("Time","nVertLevels","latitude","longitude") with the dimension names
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I reorder “zmid” via:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">zmid_reorder = zmid(levz_mid|:,latitude|:,longitude|:)<u></u><u></u></p>
<p class="MsoNormal">printVarSummary(zmid_reorder),<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">which gives the following output:<u></u><u></u></p>
<p class="MsoNormal">-----------------------------------------------------------------------------------<u></u><u></u></p>
<p class="MsoNormal">Variable: zmid_reorder<u></u><u></u></p>
<p class="MsoNormal">Type: float<u></u><u></u></p>
<p class="MsoNormal">Total Size: 2328480 bytes<u></u><u></u></p>
<p class="MsoNormal"> 582120 values<u></u><u></u></p>
<p class="MsoNormal">Number of Dimensions: 3<u></u><u></u></p>
<p class="MsoNormal">Dimensions and sizes: [levz_mid | 55] x [latitude | 98] x [longitude | 108]<u></u><u></u></p>
<p class="MsoNormal">Coordinates:<u></u><u></u></p>
<p class="MsoNormal"> latitude: [31.6178..42.50189]<u></u><u></u></p>
<p class="MsoNormal"> longitude: [-129.0292..-113.0208]<u></u><u></u></p>
<p class="MsoNormal">(0) min=-64.3161 max=29608.8<u></u><u></u></p>
<p class="MsoNormal">-----------------------------------------------------------------------------------<u></u><u></u></p>
<p class="MsoNormal">However, the reordered zmid output in netcdf file is wrong. The output of zmid without reordering of dimensions is:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> float ZH(Time, LAY, ROW, COL) ;<u></u><u></u></p>
<p class="MsoNormal"> ZH:_FillValue = 1.e+32f ;<u></u><u></u></p>
<p class="MsoNormal"> string ZH:units = "M" ;<u></u><u></u></p>
<p class="MsoNormal"> string ZH:var_desc = "mid-layer height above ground" ;<u></u><u></u></p>
<p class="MsoNormal"> string ZH:long_name = "ZH" ;<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">data:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">ZH =<u></u><u></u></p>
<p class="MsoNormal"> 9.999999, 32, 58.4, 90.09999, 128.1, 173.7, 228.45, 294.15, 373, 467.6,<u></u><u></u></p>
<p class="MsoNormal"> 581.1, 717.3, 880.75, 1076.9, 1312.3, 1594.75, 1933.7, 2340.45, 2828.55,<u></u><u></u></p>
<p class="MsoNormal"> 3414.3, 4108.8, 4858.8, 5608.799, 6358.8, 7108.8, 7858.8, 8608.8, 9358.8,<u></u><u></u></p>
<p class="MsoNormal"> 10108.8, 10858.8, 11608.8, 12358.8, 13108.8, 13858.8, 14608.8, 15358.8,<u></u><u></u></p>
<p class="MsoNormal"> 16108.8, 16858.8, 17608.8, 18358.8, 19108.8, 19858.8, 20608.8, 21358.8,<u></u><u></u></p>
<p class="MsoNormal"> 22108.8, 22858.8, 23608.8, 24358.8, 25108.8, 25858.8, 26608.8, 27358.8,<u></u><u></u></p>
<p class="MsoNormal"> 28108.8, 28858.8, 29608.8, 10, 32, 58.4, 90.10001, 128.1, 173.7, 228.45,<u></u><u></u></p>
<p class="MsoNormal"> 294.15, 373, 467.6, 581.1, 717.3, 880.75, 1076.9, 1312.3, 1594.75,<u></u><u></u></p>
<p class="MsoNormal"> 1933.7, 2340.45, 2828.55, 3414.3, 4108.8, 4858.8, 5608.8, 6358.8, 7108.8,<u></u><u></u></p>
<p class="MsoNormal"> 7858.8, 8608.8, 9358.8, 10108.8, 10858.8, 11608.8, 12358.8, 13108.8,<u></u><u></u></p>
<p class="MsoNormal"> 13858.8, 14608.8, 15358.8, 16108.8, 16858.8, 17608.8, 18358.8, 19108.8,<u></u><u></u></p>
<p class="MsoNormal"> 19858.8, 20608.8, 21358.8, 22108.8, 22858.8, 23608.8, 24358.8, 25108.8,<u></u><u></u></p>
<p class="MsoNormal"> 25858.8, 26608.8, 27358.8, 28108.8,<u></u><u></u></p>
<p class="MsoNormal"> 28858.8, 29608.8,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">----------------------------------------------------------<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The netcdf output of zmid_reorder with netcdf variable name ZH1 as test is:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> float ZH1(TSTEP, LAY, ROW, COL) ;<u></u><u></u></p>
<p class="MsoNormal"> ZH1:_FillValue = 1.e+32f ;<u></u><u></u></p>
<p class="MsoNormal"> string ZH1:units = "M" ;<u></u><u></u></p>
<p class="MsoNormal"> string ZH1:var_desc = "mid-layer height above ground" ;<u></u><u></u></p>
<p class="MsoNormal"> string ZH1:long_name = "ZH1" ;<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">data:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">ZH1 =<u></u><u></u></p>
<p class="MsoNormal"> 9.999999, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9.999999, 10, 10, 10, 10, 10,<u></u><u></u></p>
<p class="MsoNormal"> 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,<u></u><u></u></p>
<p class="MsoNormal"> 10, 10, 10, 9.999999, 10, 10, 10, 9.999999, 10, 10, 10, 10, 10, 10, 10,<u></u><u></u></p>
<p class="MsoNormal"> 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,<u></u><u></u></p>
<p class="MsoNormal"> 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 423.6477,<u></u><u></u></p>
<p class="MsoNormal"> 378.6578, 662.8945, 1097.154, 1152.52, 1072.004, 1299.672, 1005.835,<u></u><u></u></p>
<p class="MsoNormal"> 592.6567, 270.4732, 318.5765, 13.87211, 13.37675, 10, 10, 49.30841,<u></u><u></u></p>
<p class="MsoNormal"> 48.51982, 38.2547, 10.43509, 20.66064, 89.90919, 139.163, 114.4501,<u></u><u></u></p>
<p class="MsoNormal"> 201.582, 276.1719,<u></u><u></u></p>
<p class="MsoNormal"> 10, 10, 10, 10, 10, 10, 10,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">---------------------------------------------------------------<u></u><u></u></p>
<p class="MsoNormal">As another example of for the impact of variable reordering on the output, here is the information about code to read potential temperature and reordering it as well as its results:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> tk1 = a->theta<u></u><u></u></p>
<p class="MsoNormal">; copy_VarMeta(a->theta,tk1)<u></u><u></u></p>
<p class="MsoNormal">; tk1@units = ""<u></u><u></u></p>
<p class="MsoNormal"> printVarSummary(tk1)<u></u><u></u></p>
<p class="MsoNormal"> printMinMax(tk1,0)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> tk = tk1(Time|:,nVertLevels|:,latitude|:,longitude|:)<u></u><u></u></p>
<p class="MsoNormal"> printVarSummary(tk)<u></u><u></u></p>
<p class="MsoNormal"> printMinMax(tk,0)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">--------------------------------------------------------------------<u></u><u></u></p>
<p class="MsoNormal">Variable: tk1<u></u><u></u></p>
<p class="MsoNormal">Type: float<u></u><u></u></p>
<p class="MsoNormal">Total Size: 55883520 bytes<u></u><u></u></p>
<p class="MsoNormal"> 13970880 values<u></u><u></u></p>
<p class="MsoNormal">Number of Dimensions: 4<u></u><u></u></p>
<p class="MsoNormal">Dimensions and sizes: [Time | 24] x [latitude | 98] x [longitude | 108] x [nVertLevels | 55]<u></u><u></u></p>
<p class="MsoNormal">Coordinates:<u></u><u></u></p>
<p class="MsoNormal"> latitude: [31.6178..42.50189]<u></u><u></u></p>
<p class="MsoNormal"> longitude: [-129.0292..-113.0208]<u></u><u></u></p>
<p class="MsoNormal">Number Of Attributes: 2<u></u><u></u></p>
<p class="MsoNormal"> units : K<u></u><u></u></p>
<p class="MsoNormal"> long_name : Potential temperature<u></u><u></u></p>
<p class="MsoNormal">(0) Potential temperature (K) : min=282.766 max=797.725<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">data:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">TK1 =<u></u><u></u></p>
<p class="MsoNormal"> 290.8131, 290.7571, 290.7412, 290.7352, 290.734, 290.7361, 290.7417,<u></u><u></u></p>
<p class="MsoNormal"> 290.7557, 290.9228, 293.661, 296.6131, 298.7729, 301.4621, 303.3734,<u></u><u></u></p>
<p class="MsoNormal"> 305.5786, 307.7134, 309.639, 311.1685, 312.9564, 315.1082, 317.7267,<u></u><u></u></p>
<p class="MsoNormal"> 320.5912, 323.4933, 326.3149, 329.7065, 333.1702, 337.303, 339.9579,<u></u><u></u></p>
<p class="MsoNormal"> 341.5059, 344.3701, 347.8319, 354.1167, 358.0386, 360.7633, 364.5301,<u></u><u></u></p>
<p class="MsoNormal"> 372.0264, 381.8416, 392.6732, 410.2569, 427.9963, 446.3387, 469.1274,<u></u><u></u></p>
<p class="MsoNormal"> 492.7356, 513.7944, 534.12, 553.8484, 575.1737, 600.4743, 628.2712,<u></u><u></u></p>
<p class="MsoNormal"> 658.1637, 681.6721, 702.9726, 730.4858, 756.6381, 787.6335, 290.8405,<u></u><u></u></p>
<p class="MsoNormal"> 290.7827, 290.7664, 290.7603, 290.7591, 290.7614, 290.7675, 290.7849,<u></u><u></u></p>
<p class="MsoNormal"> 290.9932, 293.7723, 296.4947, 298.9371, 301.5804, 303.4898, 305.7006,<u></u><u></u></p>
<p class="MsoNormal"> 307.7661, 309.706, 311.2367, 313.1123, 315.1071, 317.8082, 320.5843,<u></u><u></u></p>
<p class="MsoNormal"> 323.5288, 326.2887, 329.711, 333.046, 337.2808, 339.8705, 341.3407,<u></u><u></u></p>
<p class="MsoNormal"> 344.2988, 348.018, 354.2007, 357.992, 360.691, 364.6261, 371.9153,<u></u><u></u></p>
<p class="MsoNormal"> 381.6589, 392.6092, 410.5144, 428.3927, 446.4816, 469.0464, 491.7896,<u></u><u></u></p>
<p class="MsoNormal"> 513.2549, 534.1764, 555.1635, 576.1888, 599.7042, 626.2191, 656.9671,<u></u><u></u></p>
<p class="MsoNormal"> 681.5657, 704.613, 733.2448,<u></u><u></u></p>
<p class="MsoNormal">-----------------------------------------------------------------------------------<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Variable: tk<u></u><u></u></p>
<p class="MsoNormal">Type: float<u></u><u></u></p>
<p class="MsoNormal">Total Size: 55883520 bytes<u></u><u></u></p>
<p class="MsoNormal"> 13970880 values<u></u><u></u></p>
<p class="MsoNormal">Number of Dimensions: 4<u></u><u></u></p>
<p class="MsoNormal">Dimensions and sizes: [Time | 24] x [nVertLevels | 55] x [latitude | 98] x [longitude | 108]<u></u><u></u></p>
<p class="MsoNormal">Coordinates:<u></u><u></u></p>
<p class="MsoNormal"> latitude: [31.6178..42.50189]<u></u><u></u></p>
<p class="MsoNormal"> longitude: [-129.0292..-113.0208]<u></u><u></u></p>
<p class="MsoNormal">Number Of Attributes: 2<u></u><u></u></p>
<p class="MsoNormal"> long_name : Reordered potential temperature<u></u><u></u></p>
<p class="MsoNormal"> units : K<u></u><u></u></p>
<p class="MsoNormal">(0) Potential temperature (K) : min=282.766 max=797.725<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">data:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">TK =<u></u><u></u></p>
<p class="MsoNormal"> 290.8131, 290.8405, 290.8532, 290.874, 290.8821, 290.8575, 290.9009,<u></u><u></u></p>
<p class="MsoNormal"> 290.9425, 290.9517, 290.9512, 290.9521, 290.9454, 290.9456, 290.9441,<u></u><u></u></p>
<p class="MsoNormal"> 290.9357, 290.9396, 290.9547, 290.9457, 290.9522, 290.9639, 290.9545,<u></u><u></u></p>
<p class="MsoNormal"> 290.9518, 290.9407, 290.9241, 290.9189, 290.9194, 290.8954, 290.8531,<u></u><u></u></p>
<p class="MsoNormal"> 290.8095, 290.7653, 290.6684, 290.5908, 290.5103, 290.4197, 290.3355,<u></u><u></u></p>
<p class="MsoNormal"> 290.2524, 290.0889, 289.9354, 289.8426, 289.769, 289.7196, 289.5693,<u></u><u></u></p>
<p class="MsoNormal"> 289.5384, 289.5408, 289.3453, 289.1881, 289.1, 289.0808, 289.054,<u></u><u></u></p>
<p class="MsoNormal"> 289.0443, 289.0854, 288.9913, 289.123, 289.17, 289.3506, 289.4048,<u></u><u></u></p>
<p class="MsoNormal"> 289.4511, 289.4771, 289.5936, 289.642, 289.163, 289.2242, 289.2056,<u></u><u></u></p>
<p class="MsoNormal"> 289.2532, 289.3674, 289.5267, 289.6508, 289.8015, 289.9764, 290.2227,<u></u><u></u></p>
<p class="MsoNormal"> 290.4557, 290.7174, 290.9393, 291.1483, 291.4482, 291.6609, 291.8963,<u></u><u></u></p>
<p class="MsoNormal"> 292.1499, 292.4067, 292.6108, 292.777, 292.8965, 293.0784, 299.2768,<u></u><u></u></p>
<p class="MsoNormal"> 299.7407, 305.4052, 313.3188, 313.5712, 314.6627, 313.7572, 313.2654,<u></u><u></u></p>
<p class="MsoNormal"> 312.6786, 311.9484, 311.588, 311.4529, 308.0678, 307.5142, 307.9211,<u></u><u></u></p>
<p class="MsoNormal"> 308.1941, 309.1768, 309.8638, 310.4225, 309.4877, 310.032, 311.1737,<u></u><u></u></p>
<p class="MsoNormal"> 311.9905, 312.4248, 311.6823,<u></u><u></u></p>
<p class="MsoNormal">---------------------------------------------------------------------------------------<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I use the following netcdf file definitions:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">theflnm = "./<a href="http://nc4_write.nc" target="_blank">nc4_write.nc</a>"<u></u><u></u></p>
<p class="MsoNormal">setfileoption("nc","format","netcdf4")<u></u><u></u></p>
<p class="MsoNormal">setfileoption("nc","headerReserveSpace",64000)<u></u><u></u></p>
<p class="MsoNormal">setfileoption("nc","preFill",False)<u></u><u></u></p>
<p class="MsoNormal">setfileoption("nc","defineMode",True)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I also tried to use the following chunking definitions, but commented them out because of the errors that I get and let the internal default definitions take over:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">;mtim = 1<u></u><u></u></p>
<p class="MsoNormal">;mlev = nlev/10<u></u><u></u></p>
<p class="MsoNormal">;mlat = nlat/10<u></u><u></u></p>
<p class="MsoNormal">;mlon = nlon/10<u></u><u></u></p>
<p class="MsoNormal">;chunk_sizes = (/mtim,mlev,mlat,mlon/)<u></u><u></u></p>
<p class="MsoNormal">;filechunkdimdef(f,dim_names,chunk_sizes,dim_unlimited)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">;filevarchunkdef(f, "TA", chunk_sizes)<u></u><u></u></p>
<p class="MsoNormal">;filevarcompressleveldef(f, "TA", 2)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Is my definition of netcdf file and/or variables in netcdf definitions wrong? Are my definitions for the order of dimensions using reorder and the order of dimensions in netcdf declarations not supposed to be the same? Just as a summary,
original variable, reordered variable and dimension declarations in netcdf attributes are (in order):<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Potential Temperature - [Time | 24] x [latitude | 98] x [longitude | 108] x [nVertLevels | 55]<u></u><u></u></p>
<p class="MsoNormal">Reordered Potential Temperature - [Time | 24] x [nVertLevels | 55] x [latitude | 98] x [longitude | 108]<u></u><u></u></p>
<p class="MsoNormal"> float TK1(TSTEP, LAY, ROW, COL) ;<u></u><u></u></p>
<p class="MsoNormal"> TK1:_FillValue = 1.e+32f ;<u></u><u></u></p>
<p class="MsoNormal"> string TK1:units = "K" ;<u></u><u></u></p>
<p class="MsoNormal"> string TK1:var_desc = "potential temperature" ;<u></u><u></u></p>
<p class="MsoNormal"> string TK1:long_name = "TK1" ;<u></u><u></u></p>
<p class="MsoNormal"> float TK(TSTEP, LAY, ROW, COL) ;<u></u><u></u></p>
<p class="MsoNormal"> TK:_FillValue = 1.e+32f ;<u></u><u></u></p>
<p class="MsoNormal"> string TK:units = "K" ;<u></u><u></u></p>
<p class="MsoNormal"> string TK:var_desc = "reordered potential temperature" ;<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thank you for your help.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Kemal.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>