Re: Problem with ushort format in netCDF4

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 15 2012 - 09:08:16 MST

Wei-Chih,

Certainly your variable pr in ushort, but the code have converted it to float/double.

So, what is exactly the problem, or do you have any error message.

Can you add:

  printVarSummary(ipr)

just below:

  printVarSummary(time1)

to check the data type of "ipr".

It now should be float or double.

Thanks,

Wei

huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Feb 15, 2012, at 8:16 AM, wei chih chen wrote:

>
> Dear user,
> I have a problem extracting nc file with my NCL code. When I tried to use this code which my colleague gave me, I got the error like " unknow netCDF format". Moreover, I found my new nc file is written in ushort format but the NCL code is for double format (the code is in the attachment for your reference). The information of the nc file is as below. Could you please give me some advices how to revise the code to extract the data? Thank you.
>
> netcdf hadcm3.a1b.grid.conus.pr.1970.1979 {
> dimensions:
> lat = 222 ;
> lon = 462 ;
> time = UNLIMITED ; // (3650 currently)
> variables:
> double lat(lat) ;
> lat:units = "degrees_north" ;
> lat:long_name = "latitude" ;
> double lon(lon) ;
> lon:units = "degrees_east" ;
> lon:long_name = "longitude" ;
> ushort pr(time, lat, lon) ;
> pr:scale_factor = 0.1 ;
> pr:units = "mm" ;
> pr:missing_value = 65535 ;
> pr:long_name = "24h_cumulative_precipitation" ;
> int time(time) ;
> time:units = "days since 1959-12-31" ;
> time:long_name = "time" ;
>
> // global attributes:
> :history = "Created using the resources of the High Performance Computing Center at Texas Tech University Thu May 19 16:01:36 CDT 2011\n: converted double to NC_USHORT with scale factor of 10 for file at location /Volumes/Scratch/conus_grid/hadcm3/hadcm3.a1b.grid.conus.pr.1970.1979.nc" ;
> :nco_openmp_thread_number = 1 ;
> :source = "Downscaled using a statistical asynchronous regression technique after Stoner & Hayhoe from the U.K. Met Office HadCM3 historical abqzda (1960-1974) and abqzdd (1975-1990) and future acfxd (1991-2099) simulations. " ;
> }
> --
> Best regards
> Wei-Chih
>
> <Data_extract.ncl>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 15 09:08:36 2012

This archive was generated by hypermail 2.1.8 : Fri Feb 17 2012 - 08:50:10 MST