[ncl-talk] how to export to NETCDF a variable processed in NCL ?

Buzan, Jonathan jbuzan at purdue.edu
Thu Oct 29 00:38:08 MDT 2020


Hi Luiz,

Please see the ncl manual.
http://www.ncl.ucar.edu/Applications/write_netcdf.shtml

-Jonathan



> On Oct 29, 2020, at 7:01 AM, Luiz Octavio Fabricio dos Santos via ncl-talk <ncl-talk at mailman.ucar.edu> wrote:
> 
> Hello, I have calculated the correlation between precipitation anomalies and sea surface temperature anomalies. 
> And I would like to export the variable with the correlation and significance values to a new NETCDF file. 
> How export variables r and sig for a new NETCDF file?  
> Can anybody help me? Thank you very much in advance.
> 
> begin
> 
>     f = addfile("Grid_Data/GPCP/aprecip_anomalia_temporal_DJF.nc", "r")
>     g = addfile("Grid_Data/ERSSTV5/nino34_DJF.nc", "r")
> 
>     ;get variables
>     ppt = f->precip
>     asst = g->asst
> 
>     ; Fix missing values
>     asst at _FillValue = 9.96921e36
>     asst at missing_value = 9.96921e36
> 
>     ppt at _FillValue = 9.96921e36
>     ppt at missing_value = 9.96921e36
> 
>     
>     x = ppt(:,:,:) ; grid data
>     y = asst(:,0,0) ; time series
> 
>     ; Calculate correlation between variables 
>     r = escorc_n(x,y,0,0)
> 
>     ; get coordinates
>     var = x(0,:,:)
>     copy_VarCoords(var,r)
> 
>     ; Get size of dimensions
>     dim = dimsizes(ppt)
>     ;Get size of dimension time
>     nt = dim(0)
> 
>     ;Significance Test
>     sig = rtest(r,nt,0)
>     ;printVarSummary(sig)
> 
>     ; get coordinates
>     copy_VarCoords(var,sig)
>     ;printVarSummary(sig)
> 
> end
> ;====================================================
> Variable: ppt
> Type: float
> Total Size: 4852224 bytes
>             1213056 values
> Number of Dimensions: 3
> Dimensions and sizes:   [time | 117] x [lat | 72] x [lon | 144]
> Coordinates:
>             time: [   0..14213]
>             lat: [-88.75..88.75]
>             lon: [1.25..358.75]
> Number Of Attributes: 2
>   _FillValue :  9.96921e+36
>   missing_value :       9.96921e+36
> ncl 39>
> ;=================================================
> printVarSummary(sig) 
> Variable: sig
> Type: float
> Total Size: 41472 bytes
>             10368 values
> Number of Dimensions: 2
> Dimensions and sizes:   [lat | 72] x [lon | 144]
> Coordinates:
>             lat: [-88.75..88.75]
>             lon: [1.25..358.75]
>  ;=============================================
> 
>  printVarSummary(r)
> 
> Variable: r
> Type: float
> Total Size: 41472 bytes
>             10368 values
> Number of Dimensions: 2
> Dimensions and sizes:   [lat | 72] x [lon | 144]
> Coordinates:
>             lat: [-88.75..88.75]
>             lon: [1.25..358.75]
> Number Of Attributes: 1
>   _FillValue :  9.96921e+36
> ;===================================================================
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk



More information about the ncl-talk mailing list