[ncl-talk] regrid from 64km to 32km

Marcella, Marc MMarcella at AIR-WORLDWIDE.COM
Mon Nov 24 08:16:17 MST 2014


Hi Dennis,

Thanks for the help.  However after looking at example 20 I noticed all the example really required/needed was a destination grid lat/lon arrays so I simply created arrays of the same lat/lon end points but double the total points (to go from 64 to 32km.)  The regridding worked, but unfortunately it took the data and actually interpolated it to 32km instead of simply “slicing up the data”.  Please see the attached figure if that makes more sense.

-Marc


From: Dennis Shea [mailto:shea at ucar.edu]
Sent: Saturday, November 22, 2014 2:45 PM
To: Marcella, Marc
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] regrid from 64km to 32km

NCL has no explicit function to create the 32km lat/lon locations.
However, if this is  "test input file" maybe you could create test set via
the following which was extracted from an example

  aDataDir       = "./"
  aFileName      = "wrfout_d01_2003-07-15_00:00:00.nc<http://00.nc>"
  aFile          = aDataDir+aFileName
  a = addfile(aFile,"r")                            ; a is the wrf output with the format of rcm

  xlat   = a->XLAT(0,:,:)
  xlon   = a->XLONG(0,:,:)
  dat   = a->TOT_PRCP

  dimll  = dimsizes(xlat)
  nlat   = dimll(0)
  mlon   = dimll(1)

  NLAT   = 2*nlat-1                                 ; make large array
  MLON   = 2*mlon-1
  XLAT   = new( (/NLAT,MLON/), typeof(xlat))
  XLON   = new( (/NLAT,MLON/), typeof(xlat))
  DAT    = new( (/NLAT,MLON/), typeof(xlat))

  XLAT(0:NLAT-1:2,0:MLON-1:2) = xlat                ; populate with every
  XLON(0:NLAT-1:2,0:MLON-1:2) = xlon                ; other value
  poisson_grid_fill(XLAT, False, 1, 1500, 1e-2, 0.6, 0)
  poisson_grid_fill(XLON, False, 1, 1500, 1e-2, 0.6, 0)
  poisson_grid_fill(DAT   , False, 1, 1500, 1e-2, 0.6, 0)  ; <== could be slow

  copy_VarMeta(xlat,XLAT)
  copy_VarMeta(xlon,XLON)

  printVarSummary(XLAT)
  printVarSummary(XLAT)
 ;print("XLAT: "+XLAT(:,0) +"  "+XLAT(:,MLON/2) +"  "+ XLAT(:,MLON-1))
 ;print("XLON: "+XLON(0,:) +"  "+XLON(NLAT/2,:) +"  "+ XLON(NLAT-1,:))

  wks  = gsn_open_wks("x11","tstgrid")
 ;gsn_define_colormap(wks,"BlAqGrYeOrRe")

  latlonres  = True
  latlonres at gsnDraw    = False
  latlonres at gsnFrame   = False
  latlonres at cnLineThicknessF   = 2
  latlonres at tiMainString = "Original Grid"

  latlonres at cnLineColor   = "red"
  plotLat = gsn_contour(wks,xlat,latlonres)
  latlonres at cnLineColor   = "blue"
  plotLon = gsn_contour(wks,xlon,latlonres)
  overlay(plotLat,plotLon)                           ; overlay on map
  draw(plotLat)
  frame(wks)

  latlonres at tiMainString = "Destination  Grid"
  latlonres at cnLineColor   = "red"
  plotLAT = gsn_contour(wks,XLAT,latlonres)
  latlonres at cnLineColor   = "blue"
  plotLON = gsn_contour(wks,XLON,latlonres)
  overlay(plotLAT,plotLON)                           ; overlay on map
  draw(plotLAT)
  frame(wks)


On Fri, Nov 21, 2014 at 12:36 PM, Marcella, Marc <MMarcella at air-worldwide.com<mailto:MMarcella at air-worldwide.com>> wrote:
Hi Dennis,

Is there a way to do this if I in fact I don’t have a destination grid file like example 20 has?  I am looking to create said destination grid file.

From: Dennis Shea [mailto:shea at ucar.edu<mailto:shea at ucar.edu>]
Sent: Friday, November 21, 2014 12:02 PM
To: Marcella, Marc
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>

Subject: Re: [ncl-talk] regrid from 64km to 32km

Based on the printVarSummary which shows the named dimensions as
  [Time | 8760] x [south_north | 106] x [west_east | 123]
You hacv a WRF grid (curvilinear) grid.

http://www.ncl.ucar.edu/Applications/ESMF.shtml
Example 20  (also, Example 16)
This is going from high resolution to low resolution but you could just use your 64km res file as input and
specify the 'destination' 32 km grid.
Note: you are interpolating precipitation. Since it is a test, bilinear would be fine. However, the conserve method may be better for some applications.
Good luck

On Fri, Nov 21, 2014 at 9:44 AM, Marcella, Marc <MMarcella at air-worldwide.com<mailto:MMarcella at air-worldwide.com>> wrote:

1)      Yes, I meant it would be a misrepresentation of resolution since it will be at 32km physically but in reality it is 64km information.

2)      I have a 64km resolution dataset that I want to slice up into 32 km resolution for example going from say a 50x50 grid to 100x100 grid (4x total points) I attached an illustration if this makes it clearer.
The original data is curvilinear (output from WRF data) but this data itself is plucked out of the wrfout files and placed onto a grid that knows nothing about the lat/lon and I am fine keeping it in a rectilinear grid as seen here by the printVarSummary:
Variable: TOT_PRCP
Type: float
Total Size: 456851520 bytes
114212880 values
Number of Dimensions: 3
Dimensions and sizes:   [Time | 8760] x [south_north | 106] x [west_east | 123]
Coordinates:
Number Of Attributes: 3
_FillValue :  9.96921e+36
units :       mm/hr
description : Total hourly precipitation accumulation

Thank you for your help with this!
Marc


From: Dennis Shea [mailto:shea at ucar.edu<mailto:shea at ucar.edu>]
Sent: Friday, November 21, 2014 11:27 AM
To: Marcella, Marc; ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] regrid from 64km to 32km


I think you have to provide more information.
[1] Not sure what you mean by "this  would be an incorrect regridding format/procedure". Do you mean going from low -resolution to high-resolution? There is nothing "incorrect" about that. The issue is that the *effective resolution* would stll be 64km but the data are rendered on a 32km grid.
[2] The rest of the question is obscure.
[3] *ALWAYS* include a printVarsummary of the source variable.
     (a) Is the source grid rectilinear or curvilinear? If curvilinear, then linint2 is not the function to use.

On Fri, Nov 21, 2014 at 7:58 AM, Marcella, Marc <MMarcella at air-worldwide.com<mailto:MMarcella at air-worldwide.com>> wrote:
Hi NCL’ers,

I would like to take a current dataset that is 64 km, say at dimensions j=106 x i=123 and “regrid” it such that the gridcells are just sliced up into 32km resolution grid cells, ie the final product would have dimensions of 212x246.  I do recognize that this  would be an incorrect regridding format/procedure but I just need the grid for a test input file. I tried the linint2 regridding but this kept the first (lower left) 106x123 gridcells the original values and all the additional/new gridcells outside this box were FillValues.  Is there an easy way to do this with a regrid or NCL function?

Thanks for any help in advance!

Marc




_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141124/6b324093/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: regrid_ESMF.JPG
Type: image/jpeg
Size: 60733 bytes
Desc: regrid_ESMF.JPG
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141124/6b324093/attachment.jpe 


More information about the ncl-talk mailing list