Re: interpolating error.

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 26 2013 - 11:28:42 MDT

Hi Igor,

I don't understand your intention with this short script, and it doesn't really seem to match with what the output of the NCEP file is saying.

For example, you said you wrote the variable to the file with:

> b->t_10=(/t_10/)

which should have stripped off all the coordinates and attributes, yet your "ncdump" on the file indicates it has coordinates and attributes:

> float t_10(time, lat, lon) ;
> t_10:long_name = "Air Temperature" ;
> t_10:units = "Kelvin" ;
> t_10:level = "10m shifted" ;
> t_10:sampling_time = "fcst-6" ;
> t_10:comment = "FFT of 1958-2000 NCEP time series" ;
> t_10:code = "/home/blackforest/yeager/DAVE/NCEPNY/fft_transform_2D_t10_bmethod.run" ;
> t_10:method = "uncorrected; no b-factor added" ;
> t_10:_FillValue = -999.f ;

The "t_10" variable has new attributes on it. Did you add these yourself?

You said "After interpolation of ncep-ncar data onto a model grid, the interpolated and original data don't match up". What interpolation did you use?

Also, your "air" variable is a "short" and somehow "t_10" got written as a float. Did you convert it to float somewhere?

Finally, and this is important, "air" is a short, and you need to apply the "add_offset" and "scale_factor" attribute values:

                air:add_offset = 477.65f ;
                air:scale_factor = 0.01f ;

 in order to correctly convert it to float. Did you do this? We have a function that does this for you:

                t_10=short2flt(a->air)

The ordering of the dimensions on the file don't matter.

It would help if you could provide the full script, and more detail about the grid that the original data is on, and the grid that you are interpolating to. Are they really both the same size, 94 x 192?

--Mary

On Apr 25, 2013, at 4:30 PM, igor akkerman wrote:

> Hi,
>
> After interpolation of ncep-ncar data onto a model grid, the interpolated and original data don't match up. The number of latitudes, longitudes and time is the same so basically I just wrote the data under a different filename. Maybe that's what wrong and I should have applied some special interpolation function? Or maybe the fields don't match up because in the NCEP-NCAR reanalysis the dimensions are flipped (lon first, lat second)?
>
> NCEP-NCAR:
> lon = 192 ;
> lat = 94 ;
> time = UNLIMITED ; // (1460 currently)
> MODEL forcing:
> lat = 94 ;
> lon = 192 ;
> time = UNLIMITED ; // (1460 currently)
>
>
> Below I copied my NCL script and info on the ncep-ncar reanalysis data:
>
> 1) NCL CODE:
> pacman8 1016% vi write_t2.ncl
>
> load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> begin
> ; ------------------ "read data1 file" --------------
> i=1979
> a = addfile("air.2m.gauss."+i+".nc","r")
> b = addfile("ncep.t_10.T62."+i+".26JAN2010.nc","w")
> t_10=a->air
> b->t_10=(/t_10/)
> end
>
>
> 2) NCDUMP -H on NCEP-NCAR;
>
> netcdf air.2m.gauss.1979 {
> dimensions:
> lon = 192 ;
> lat = 94 ;
> time = UNLIMITED ; // (1460 currently)
> variables:
> float lat(lat) ;
> lat:units = "degrees_north" ;
> lat:actual_range = 88.542f, -88.542f ;
> lat:long_name = "Latitude" ;
> lat:standard_name = "latitude" ;
> lat:axis = "Y" ;
> float lon(lon) ;
> lon:units = "degrees_east" ;
> lon:long_name = "Longitude" ;
> lon:actual_range = 0.f, 358.125f ;
> lon:standard_name = "longitude" ;
> lon:axis = "X" ;
> double time(time) ;
> time:units = "hours since 1-1-1 00:00:0.0" ;
> time:long_name = "Time" ;
> time:actual_range = 17338824., 17347578. ;
> time:delta_t = "0000-00-00 06:00:00" ;
> time:avg_period = "0000-00-00 06:00:00" ;
> time:standard_name = "time" ;
> time:axis = "T" ;
> short air(time, lat, lon) ;
> air:long_name = "4xDaily Air temperature at 2 m" ;
> air:unpacked_valid_range = 150.f, 400.f ;
> air:actual_range = 167.6f, 328.7f ;
> air:units = "degK" ;
> air:add_offset = 477.65f ;
> air:scale_factor = 0.01f ;
> air:missing_value = 32766s ;
> air:precision = 2s ;
> air:least_significant_digit = 1s ;
> air:GRIB_id = 11s ;
> air:GRIB_name = "TMP" ;
> air:var_desc = "Air temperature" ;
> air:dataset = "NMC Reanalysis" ;
> air:level_desc = "2 m" ;
> air:statistic = "Mean" ;
> air:parent_stat = "Individual Obs" ;
> air:valid_range = -32765s, -7765s ;
>
> 3) NCDUMP -H ON MODEL forcing data
>
> netcdf ncep.t_10.T62.1971.26JAN2010 {
> dimensions:
> lat = 94 ;
> lon = 192 ;
> time = UNLIMITED ; // (1460 currently)
> variables:
> float lat(lat) ;
> lat:long_name = "latitude" ;
> lat:units = "degrees_north" ;
> float lon(lon) ;
> lon:long_name = "longitude" ;
> lon:units = "degrees_east" ;
> float t_10(time, lat, lon) ;
> t_10:long_name = "Air Temperature" ;
> t_10:units = "Kelvin" ;
> t_10:level = "10m shifted" ;
> t_10:sampling_time = "fcst-6" ;
> t_10:comment = "FFT of 1958-2000 NCEP time series" ;
> t_10:code = "/home/blackforest/yeager/DAVE/NCEPNY/fft_transform_2D_t10_bmethod.run" ;
> t_10:method = "uncorrected; no b-factor added" ;
> t_10:_FillValue = -999.f ;
> _______________________________________________
> 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 Fri Apr 26 11:28:55 2013

This archive was generated by hypermail 2.1.8 : Fri Apr 26 2013 - 17:10:25 MDT