netcdf files regrid/interpolate problem

From: Igor Stepanov <igor.stepanovski_at_nyahnyahspammersnyahnyah>
Date: Thu Jan 12 2012 - 09:05:56 MST

Dear NCL group,

i am a "long time listener, first time caller" on the NCL talk group, been
using a lot of useful tips from all the members. Now it is the first time i
had to go rogue from an eavesdropper to a participant, so i hope somebody
will have a clue how my hurdle can be tackled.

The problem is to regrid/interpolate a variable written in a netcdf file,
to a specific grid/resolution. These are all 2D variables, and in order to
divide them or make a scatter plot with them - i need to have them on the
same grids and with identical dimensions.

To make things to the point and to refer to them more easily, i have 3 .nc
files:

radar_output.nc,
lid_l2a_output.nc and
reff_slice_rev.nc,

and these are ncl_filedump outputs of these files:

radar_output.nc:
dimensions:
      one = 1
      nx = 255
      ny = 1
      nz = 90
  float CPR_Reflectivity ( nz, nx )
         long_name : Reflectivity [94 GHz]
         units : mm^6 m^-3
         plot_title : Reflectivity [mm\U6\D/m\U3\D] [94 GHz]

lid_l2a_output.nc:
  dimensions:
      nx = 51
      ny = 1
      nz = 139
      one = 1
 float Extinction_3 ( nz, nx )
         long_name : Extinction_3
         units : 1/m
         plot_title : Extinction [1/m]

and finally reff_slice_rev.nc
  dimensions:
      nz = 80
      nx = 512
 variables:
      float R_eff ( nz, nx )
         long_name : effective radius
         units : microns
         plot_title : R\deff\u [microns]

It doesn't matter to which grid i eventually need to use for all of them,
as long as they are the same. Maybe it would be best to get them all to
lid_l2a_output.nc grid, as it is the lowest one.

Basically, i need to make a scatter plot of CPR_Reflectivity / Extinction_3
vs. R_eff, and
from what i understand they all need to have the same number of grid points
on both x and z direction. I read in the variables

fin =
addfile("/data/ECSIMv15/sessions/hr18_ecsimreff_up/dave_20111130182841/
radar_output.nc","r") ;satellite, hr18
reflectivity = fin->CPR_Reflectivity(:,:)
reflectivity=where(reflectivity.le.0,0.0001,reflectivity) ;this is
eliminating negative values of z
reflectivity=10.0*log10(reflectivity) ;converting mm6/m3 into dBz

and from some on line examples have understood that i need to manually
create a new grid to which all the values in memory will be interpolated,
with something like this:

 xinc = 1.0 / (NX - 1)
  yinc = 1.0 / (NZ - 1)
  ii = fspan(0.0, 255.0, NX)
  xo = xinc * ii
  yo = yinc * ii

and then finish with a simple writing of the regrided file, for example the
radar_output.nc.

;*****Delete an existing netCDF file, if present*****
ncdf_filename = "regrided_radar.nc"
if(isfilepresent(ncdf_filename)) then
system("/bin/rm " + ncdf_filename)
end if
;****************************************************

fout=addfile("/data/ECSIMv15/sessions/hr18_ecsimreff_up/regrided_radar.nc
","c")
fout->CPR_Reflectivity = fin->CPR_Reflectivity(xo|:, yo|:)

It does not work as it is, and the error message i get is:

fatal:Number of dimensions in parameter (0) of (dsgrid2s) is (2), (1)
dimensions were expected

Thank you very much if you have a look-see of my email,

best,
//Igor

-- 
Dipl.-Met. Igor Stepanov
Faculty of Electrical Engineering, Mathematics and Computer Sciences
Tel: +31(0)15 2789543
http://rse.ewi.tudelft.nl
skype: stepig

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jan 12 09:06:07 2012

This archive was generated by hypermail 2.1.8 : Wed Jan 18 2012 - 09:21:55 MST