[ncl-talk] Binary file

Mateus Dias Nunes nunes.mateusdias at gmail.com
Fri Feb 23 00:58:16 MST 2018


Hello,

I'm trying to convert this my binary data (output from a mesoscale model)
to the netCDF extension. However I am encountering difficulties because the
values not plotted do not agree with the values when I write the values of
each point on the screen.

Below the data link and the script:

https://drive.google.com/open?id=1KO_bm_oa88OVKaAcXLLg_1HGcyMgximg

begin
  nlat = 101
  nlon = 361
  fils = systemfunc("ls ozo130501012.350_950")

;---Predefine array for one year of daily data
  finarr = new((/dimsizes(fils),nlat,nlon/),"float")

;---Loop through each file and read
  rec_num = 0     ; record number
  do gg = 0,dimsizes(fils)-1
     finarr(gg,:,:) = fbindirread(fils(gg),rec_num,(/nlat,nlon/),"float")
  end do

  print("Assigning coordinate variable information")
  finarr!0 = "time"
  finarr!1 = "lat"
  finarr!2 = "lon"
  finarr&time = ispan(1,dimsizes(fils),1)
  finarr&lat  = fspan(-89,10,nlat)
  finarr&lon  = fspan(0,360,nlon)
  finarr&lat at units = "degrees_north"
  finarr&lon at units = "degrees_east"

;----------------------------------------------------------------------
; Section to write data to netCDF file
;----------------------------------------------------------------------

;---Make sure file doesn't exist.
  nc_filename = "ozone_20130501.nc"
  system("rm -f " + nc_filename)

;---Open file and write global attributes
  a = addfile("ozone_20130501.nc","c")
  a at title = "1 year of daily data"
  a at source = "exemplo"

;---Make time an UNLIMITED dimension, always recommended
  filedimdef(a,"time",-1,True)

;---Write "SLP" data to file
  a->ozonio = finarr

end


Please, help me.

_______________________________________________________________________________________

MATEUS DIAS NUNES
Doutorando do Programa de Pós-Graduação em Meteorologia - CPTEC / INPE
Centro de Previsão do Tempo e Estudos Climáticos / Instituto Nacional de
Pesquisas Espaciais
Rodovia Presidente Dutra, km 39, Cachoeira Paulista - SP - Brasil
WhatsApp: +55 (53) 98112-5154

____________________________________________
___________________________________________



‌
<https://mailtrack.io/> Sent with Mailtrack
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality&>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180223/b647a5c4/attachment.html>


More information about the ncl-talk mailing list