Re: Problem with ushort format in netCDF4

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 15 2012 - 12:14:20 MST

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

    f = addfile("hadcm3.a1b.grid.conus.pr.1970.1979 .nc", "r")
    pr_us = f->pr
    pr = pr_us*pr_us@scalefactor
    copy_VarMeta(pr_us, pr)
    delete(pr_us)

On 2/15/12 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
> <http://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
>
>
>
> _______________________________________________
> 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 12:14:33 2012

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