Changing variables/parameters of a file from double to float

From: Rashed Mahmood <rashidcomsis_at_nyahnyahspammersnyahnyah>
Date: Fri Nov 29 2013 - 12:21:21 MST

Hi all,

I am trying to change lon, lat and lev parameters of a file from double to
float. I have written simple ncl script that can run but the result is not
as desired, NCL is not replacing the actual parameters instead adding three
extra parameters named as ncl4, ncl5, ncl6 as can be seen in ncdump of the
modified file below. I am using NCL 6.1.2.

Any suggestions?

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/contributed.ncl"
begin

a = addfile("/home/rrm/khan/airc_data/test_airc/test_3/eclipse.mmrbc.2008.nc
","w")

lon1 = a->lon
lon2=doubletofloat(lon1) ;for lon

a->lon=lon2

;++++++++++++++++++++++++++++++
lat1 = a->lat
lat2=doubletofloat(lat1) ; for lat

a->lat=lat2
;++++++++++++++++++++++++++++++
lev1 = a->lev
lev2=doubletofloat(lev1) ; for lev

a->lev=lev2

end

rrm:lx25:Linux>ncdump -h eclipse.mmrbc.2008.nc
netcdf eclipse.CanAM46.3hourly.mmrbc.2008 {
dimensions:
        time = UNLIMITED ; // (2920 currently)
        lon = 128 ;
        lat = 64 ;
        lev = 49 ;
        ncl4 = 128 ;
        ncl5 = 64 ;
        ncl6 = 49 ;

variables:
        double time(time) ;
                time:long_name = "time" ;
                time:units = "days since 1850-1-1" ;
                time:calendar = "365_day" ;
        double lon(lon) ;
                lon:long_name = "Longitude" ;
                lon:units = "degrees_east" ;
                lon:standard_name = "longitude" ;
        double lat(lat) ;
                lat:long_name = "Latitude" ;
                lat:units = "degrees_north" ;
                lat:standard_name = "latitude" ;
        double lev(lev) ;
                lev:long_name = "Hybrid Sigma Pressure Level" ;
                lev:units = "1" ;
                lev:standard_name =
"atmosphere_hybrid_sigma_pressure_coordinate" ;
                lev:positive = "down" ;
                lev:formula = "p = ap + b*ps" ;
                lev:formula_terms = "ap: ap b: b ps: ps" ;
        double ap(lev) ;
        double b(lev) ;
        double ps(time, lat, lon) ;
                ps:long_name = "Surface Pressure" ;
                ps:units = "Pa" ;
                ps:standard_name = "surface_air_pressure" ;
        float mmrbc(time, lev, lat, lon) ;
                mmrbc:long_name = "Mass Fraction of Black Carbon" ;
                mmrbc:standard_name =
"mass_fraction_of_black_carbon_dry_aerosol_in_air" ;
                mmrbc:units = "kg kg-1" ;
                mmrbc:_FillValue = 1.e+38f ;

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 29 12:21:34 2013

This archive was generated by hypermail 2.1.8 : Wed Dec 04 2013 - 20:42:38 MST