[ncl-talk] Binary file

Barry Lynn barry.h.lynn at gmail.com
Fri Feb 23 01:15:21 MST 2018


Hi:

I am not sure what your problem is, and you might be aware that arrays in
NCL or (time, j,i), or (time,nlon,nlat). I believe this is the case evenif
you are reading a file of i,j,time dimensions.

Barry



On Fri, Feb 23, 2018 at 9:58 AM, Mateus Dias Nunes <
nunes.mateusdias at gmail.com> wrote:

> 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 <+55%2053%2098112-5154>
>
> ____________________________________________________________
> ___________________________
>
>
>
>> <https://mailtrack.io/> Sent with Mailtrack
> <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality&>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
Barry H. Lynn, Ph.D
Senior Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581

C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
US 914 432 3108
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180223/2c1e4461/attachment.html>


More information about the ncl-talk mailing list