Re: regridding from GPCP to REGCM grid [Was: (no subject)]

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Feb 07 2013 - 09:55:33 MST

Dear Mahmoud,

Please, in the future, include ncl-talk on the response, and not just me. It's important that people see the follow-up questions and answers.

If you want to do regridding with the ESMF routines, you will have to download V6.1.0 or V6.1.2, which was just released today.

If you don't want to upgrade, then you can try the "rgrid2rcm" function:

http://www.ncl.ucar.edu/Document/Functions/Built-in/rgrid2rcm.shtml

--Mary

On Feb 6, 2013, at 3:21 PM, mahmoud elkarim wrote:

> dear mary
> thank you so much for helping me but i'm using ncl version 6.00 and i found problem in
> load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl" for that i'm trying to install the latest version that you told about and
>
> i wish to install it successfully
>
> regards
> mahmoud
> On Sat, Feb 2, 2013 at 12:25 AM, Mary Haley <haley@ucar.edu> wrote:
> Dear Mahmoud Gaber,
>
> You are trying to subtract two 2-dimensional arrays which are different sizes. prec1 is 127 x 129, and prec is 111 x 130. NCL cannot subtract two multi-dimensional arrays that are different sizes.
>
> I see that you were trying to regrid, so I'll try to help you with that.
>
> Your GPCP grid is rectilinear (because it has 1-dimensional coordinate arrays), and your REGCM grid is curvilinear (because it has 2-dimensional coordinate variables on the file).
>
> So, using code from the "ESMF_rect_to_curv.ncl" template file in http://www.ncl.ucar.edu/Applications/Templates, you can replace this code:
>
> Opt = True
> Opt@WgtFileName = "30day_SRFmeanDJF.nc" ; default is "weights_file.nc"
> ;---Destination file options
> Opt@DstGridType = "0.5x0.5" ; 5x5 degree grid
> Opt@DstLLCorner = (/ -60.d, 0.d/)
> Opt@DstURCorner = (/ 60.d, 355.d/)
>
> Opt@SrcForceOverwrite = True
> Opt@DstForceOverwrite = True
> Opt@WgtForceOverwrite = True
> ;;Opt@PrintTimings = True
> ;;Opt@Debug = True
> ;
>
> ; temp_regrid = ESMF_regrid(p,Opt)
>
> with this code (UNTESTED):
>
> ;---Set up regridding options
> Opt = True
>
> ;---"bilinear" is the default. "patch" and "conserve" are other options.
> Opt@InterpMethod = "bilinear"
>
> Opt@WgtFileName = "gpcp_to_regcm_wgts.nc"
>
> Opt@SrcRegional = True
> Opt@DstRegional = True ;;--Change (maybe)
>
> Opt@ForceOverwrite = True
> Opt@PrintTimings = True
> Opt@Debug = True
>
> prec_regrid = ESMF_regrid(prec,Opt) ; Do the regridding
>
> printVarSummary(prec_regrid)
>
> Note that you may also want to set these options, which can make the regridding go faster:
>
> Opt@DstLLCorner = (/ -60.d, 0.d/) ; lower left corner, (/lat,lon/)
> Opt@DstURCorner = (/ 60.d, 355.d/) ; upper right corner (/lat,/lon/)
>
> Use values that are close to the limits of your REGCM grid.
>
> prec_regrid should now be the same size as "prec1".
>
> --Mary
>
>
> On Feb 1, 2013, at 2:39 PM, mahmoud elkarim wrote:
>
>> dear all
>> find attached ncl scripits
>> I'm beginner user in ncl scripts
>> when i was trying to find precipitation bias which is the difference between regcm output and GPCP observed data i found this error
>> (fatal:Minus: Dimension size, for dimension number 0, of operands does not match, can't continue)
>> and i don't know how i can regrid gpcp to regcm
>>
>> rgcm file dump is
>> x = 129 ;
>> y = 127 ;
>> m10 = 1 ;
>> m2 = 1 ;
>> lev = 2 ;
>> time = UNLIMITED ; // (1 currently)
>> nb2 = 2 ;
>> variables:
>> float xlon(y, x) ;
>> xlon:standard_name = "longitude" ;
>> xlon:long_name = "Longitude at cross points" ;
>> xlon:units = "degrees_east" ;
>> xlon:_CoordinateAxisType = "Lon" ;
>> float xlat(y, x) ;
>> xlat:standard_name = "latitude" ; smw:cell_methods = "time: point" ;
>> float tpr (time, y, x) ;
>> tpr:standard_name = "precipitation_flux" ;
>> tpr:long_name = "Total precipitation" ;
>> tpr:units = "kg m-2 day-1" ;
>> tpr:coordinates = "xlon xlat" ;
>> tpr:cell_methods = "time: mean (interval: 3 hours)" ;
>>
>> xlat:long_name = "Latitude at cross points" ;
>> xlat:units = "degrees_north" ;
>> xlat:_CoordinateAxisType = "Lat" ;netcdf gpccDJFmeanbox {
>>
>>
>> and gpgp dump is
>> dimensions:
>> lon = 130 ;
>> lat = 111 ;
>> time = UNLIMITED ; // (1 currently)
>> variables:
>> double lon(lon) ;
>> lon:standard_name = "longitude" ;
>> lon:long_name = "longitude" ;
>> lon:units = "degrees_east" ;
>> lon:axis = "X" ;
>> double lat(lat) ;
>> lat:standard_name = "latitude" ;
>> lat:long_name = "latitude" ;
>> lat:units = "degrees_north" ;
>> lat:axis = "Y" ;
>> double time(time) ;
>> time:standard_name = "time" ;
>> time:units = "days since 1901-01-01 00:00:00" ;
>> time:calendar = "proleptic_gregorian" ;
>> float p(time, lat, lon) ;
>> p:long_name = "full data precipitation version6" ;
>> p:units = "mm/month" ;
>> p:code = 16 ;
>> p:_FillValue = -99999.99f ;
>>
>>
>>
>> i ask if any one could help me
>> thanks for attention
>>
>>
>>
>>
>> > Mahmoud Gaber
>> > Nile Forecasting center (NFC)
>> > minister of water resources and irrigation (MWRI)
>> <gpcp.ncl>_______________________________________________
>> 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 Feb 7 09:55:29 2013

This archive was generated by hypermail 2.1.8 : Wed Feb 13 2013 - 09:25:58 MST