Re: (no subject)

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Feb 01 2013 - 15:25:55 MST

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 Fri Feb 1 15:26:06 2013

This archive was generated by hypermail 2.1.8 : Fri Feb 01 2013 - 15:31:04 MST