[ncl-talk] Data conversion

HAVENER, KEVIN F GS-12 USAF ACC 14 WS/WXED kevin.havener at us.af.mil
Fri Feb 5 07:15:57 MST 2016


And you don't want to try to add 75.0 to the fill value in the script.

Kevin Havener

-----Original Message-----
From: ncl-talk-bounces at ucar.edu [mailto:ncl-talk-bounces at ucar.edu] On Behalf Of alesall
Sent: Friday, February 05, 2016 9:03 AM
To: Benjamin Alabi
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] Data conversion


the error message is:

fatal:Undefined identifier: (byte2flt) is undefined, can't continue

it is not finding the function “byte2flt"
on the documentation page, this one: <http://ncl.ucar.edu/Document/Functions/Contributed/byte2flt.shtml>
it says that such function is in the “contributed” file.

you need to add statements such as:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl <http://ncl.ucar.edu/Document/Functions/Contributed/contrib.shtml> "
at the beginning of your script, actually before the “begin”

I have all of these in my scripts:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

hope this helps!



--
Alessandra Giannini
IRI for Climate and Society - The Earth Institute at Columbia University P.O. Box 1000, Palisades NY 10964-8000
phone/fax: +1 845 680-4473/4864 - email: alesall at iri.columbia.edu


	On Feb 5, 2016, at 8:57 AM, Benjamin Alabi <alabibenjamin2 at gmail.com> wrote:

	Goodday sir,
	
	I appreciate your effort in guiding me. I'm new in this platform, please dont be offended by sending the message three times, I'm just learning to get help from here. 
	
	I used the script, 
	begin
	file_name_read = "merg_2012090101_4km-pixel"
	
	ir_u = byte2flt( fbindirread (file_name_read ,0, (/2,3298,9896/),"ubyte")) +75.0
	
	
	lon_g = fspan(0.0182,360,9896)
	lat_g = fspan(59.982,59.982-0.036383683*3298,3298)
	 
	lon_g at units      = "degrees_east"
	lon_g at long_name  = "longitude"
	lon_g at short_name = "longitude"
	lon_g!0 = "lon"
	lon_g&lon = lon_g
	
	lat_g at units      = "degrees_north"
	lat_g at long_name  = "latitude"
	lat_g at short_name = "latitude"
	lat_g!0 = "lat"
	lat_g&lat = lat_g
	
	
	ir_u!0      = "time"
	ir_u!1      = "lat"
	ir_u!2      = "lon"
	
	ir_u&lat    = lat_g
	ir_u&lon    = lon_g
	
	ir_u at _FillValue= 255+75.0
	
	
	wks = gsn_open_wks("X11","")
	res = True
	res at cnFillOn = True
	res at cnFillMode = "RasterFill"
	res at cnLinesOn = False
	plot = gsn_csm_contour_map(wks, ir_u(0,:,:), res)
	
	ncout = addfile(file_name_read+".nc","c")
	ncout->ir_data = ir_u
	
	end
	
	
	But it was generating this error:
	fatal:Undefined identifier: (byte2flt) is undefined, can't continue
	fatal:["Execute.c":7741]:Execute: Error occurred at or near line 41
	
	
	Waiting for guide, Thanks.
	
	

	On Thu, Feb 4, 2016 at 8:07 PM, Alan Brammer <abrammer at albany.edu> wrote:
	

		Forgot the offset, which is mentioned in the link Kevin sent. 


		ir_u = byte2flt( fbindirread (file_name_read ,0, (/2,3298,9896/),"ubyte")) +75.
		ir_u at _FillValue= 255+75.

		"Each record is a 9896 x 3298 Fortran array of IR brightness temperatures that have been scaled to fit into 1-byte by subtracting "75" from each datum. Therefore it is necessary for the user to add a value of "75" to each data value when using the data."



			On 4 Feb 2016, at 13:30, Alan Brammer <abrammer at albany.edu> wrote:

			ok, wow. Don’t send the same message 3 times, if the first answers weren’t complete at least expand and attempt something not just copy paste the same lines again.  

			as said before .Z means it’s compressed.  gunzip merg_2016020123_4km-pixel.Z  will uncompress it. Then you have a binary file as a small amount of googling would have told you.  
			The same search would have linked you to various messages on here and various scripts where other people have included simple examples of this file type (myself included). Here is an example of reading and making a simple plot.  There are plenty of examples on how to write netcdf on the NCL website so you should develop code from there.  Most simple example at bottom of script below. 
			https://www.ncl.ucar.edu/Applications/o-netcdf.shtml

			Read the documentation on the below functions and understand what is occurring .


			begin
			file_name_read = "merg_2016020123_4km-pixel"

			ir_u = byte2flt( fbindirread (file_name_read ,0, (/2,3298,9896/),"ubyte")) 


			lon_g = fspan(0.0182,360,9896)
			lat_g = fspan(59.982,59.982-0.036383683*3298,3298)
			 
			lon_g at units      = "degrees_east"
			lon_g at long_name  = "longitude"
			lon_g at short_name = "longitude"
			lon_g!0 = "lon"
			lon_g&lon = lon_g

			lat_g at units      = "degrees_north"
			lat_g at long_name  = "latitude"
			lat_g at short_name = "latitude"
			lat_g!0 = "lat"
			lat_g&lat = lat_g


			ir_u!0      = "time"
			ir_u!1      = "lat"
			ir_u!2      = "lon"

			ir_u&lat    = lat_g
			ir_u&lon    = lon_g

			ir_u at _FillValue= 255


			wks = gsn_open_wks("X11","")
			res = True
			res at cnFillOn = True
			res at cnFillMode = "RasterFill"
			res at cnLinesOn = False
			plot = gsn_csm_contour_map(wks, ir_u(0,:,:), res)

			ncout = addfile(file_name_read+”.nc”,”c”)
			ncout->ir_data = ir_u

			end






				On 4 Feb 2016, at 13:04, Benjamin Alabi <alabibenjamin2 at gmail.com> wrote:

				Thanks for your assistance sir. I've tried the cdo to get general information on the data, but it didn't work
				I need help from someone that can guide me to convert this data format - 'merg_2012091000_4km-pixel.Z' to netcdf format.
				I download Gobally-merged (60N-60S) pixel-resolution IR brightness temperature data (equivalent blackbody temps), merged from all available geostationary satellites (GOES-8/10, METEOSAT-7/5)
				This is the link:
				http://mirador.gsfc.nasa.gov/cgi-bin/mirador/presentNavigation.pl?tree=project&dataset=Global-merged%20IR%20Brightness%20Temperature%20Data&project=TRMM&dataGroup=Ancillary&version=001&CGISESSID=25c6337b80163b3743e8bea85d015558.
				
				I really want it to be in netcdf format.
				
				
				Regard
				
				
				

				_______________________________________________
				ncl-talk mailing list
				ncl-talk at ucar.edu
				List instructions, subscriber options, unsubscribe:
				http://mailman.ucar.edu/mailman/listinfo/ncl-talk
				




	_______________________________________________
	ncl-talk mailing list
	ncl-talk at ucar.edu
	List instructions, subscriber options, unsubscribe:
	http://mailman.ucar.edu/mailman/listinfo/ncl-talk
	




More information about the ncl-talk mailing list