Re: Regridding from low to high resolution ?

From: Madeleine Patterson <madeleine.patterson77_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 14 2012 - 15:40:45 MDT

Hi Danny, thanks for pointing out this caveat, but I need data at a finer
resolution for my model input than the resolution of the dataset I am
working with.

M.

On Fri, Jun 15, 2012 at 7:03 AM, Daniel Barandiaran
<dbarandiaran@gmail.com>wrote:

> Hi Madeleine,
>
> I just wanted to throw in a quick caveat not having to do with the coding:
> when interpolating, it is generally not such a good idea to interpolate
> from a coarse grid to a finer grid, because the points on the fine grid are
> being filled with "phantom" data that might not accurately reflect what the
> fine grid would actually contain if the dataset in question was created
> using the fine grid in the first place. If you have two datasets with
> different grids and want to interpolate one to the other for whatever
> reason, you should interpolate the fine grid to the coarse one, not vice
> versa, and if you are just regridding one field to get a denser dataset,
> that you have to take the finer grid with a grain of salt, especially if
> the finer grid is a lot finer than the coarse one.
>
> Danny
>
> On Thu, Jun 14, 2012 at 2:46 PM, Madeleine Patterson <
> madeleine.patterson77@gmail.com> wrote:
>
>> Hi Mary,
>>
>> Sorry about the cluenessness about ncl-talk etiquette!
>>
>> I have set up the function declaration at the start of the code, before
>> the main script, but am unsure of what I need to do to implement the
>> function and where, in the main body of the script (i.e. after I've open
>> files and read variables into variable names, etc.)
>>
>> In your example below, I would -after opening files and reading in
>> variables -define clon, clat, tlon and tlat, but what do I do then? use the
>> regrid_cat function that I've already defined (and if so, how?), as well as
>> the 'testd=grid2triple()...' and 'pctpftnew=triple2grid()...' commands?
>>
>> In grid2triple command, 'z' should be 2-d, but in my case it is 3-d (10
>> pfts, 91 lats, 144 lons)
>>
>> Is there an example script you could point me to that creates a function
>> and implements it later in the script?
>>
>> Thanks,
>> M
>>
>> ******
>> You are missing a "begin" after the "function" declaration.
>>
>> In general, I would recommend not putting a function declaration right in
>> the middle of your main program. It's cleaner to do it like this:
>>
>> 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"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>
>> undef("regrid_cat")
>> function regrid_cat(clat[*],clon[*],pctpft[*][*],tlat[*],tlon[*]) ;
>> categorical grid and target grid
>> begin
>> testd=grid2triple(clon,clat,pctpft) ; testd(3,ld)
>> pctpftnew = triple2grid(testd(0,:),testd(1,:),testd(2,:),tlon,tlat,False)
>>
>> copy_VarAtts(pctpft,pctpftnew) ;contributed.ncl
>> cnew!0 = "lat"
>> cnew!1 = "lon"
>> cnew&lat =tlat
>> cnew&lon =tlon
>>
>> return(pctpftnew)
>> end
>>
>>
>> begin
>>
>> setfileoption("nc","SuppressClose",False)
>>
>> in1 = addfile("pft_file1.nc","r")
>>
>> pctpft = in1->PCT_PFT
>>
>> clat=90
>> clon=144
>> tlat=360
>> tlon=720
>> . . .
>>
>> end
>>
>>
>>
>>
>> _______________________________________________
>> 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 Thu Jun 14 15:40:53 2012

This archive was generated by hypermail 2.1.8 : Mon Jun 25 2012 - 09:57:23 MDT