Hi Marry,
Thank you for your mail. Could you please suggest me which part of the
code I should change by what ? Here you go the code I am using:
==========================================================
;---Open data source file
sfile = addfile(DataPathName,"r")
;---Get the source file data (Daymet) lat/lon grid: used for src grid
description
lat2d = sfile->lat
lon2d = sfile->lon
dim2d = dimsizes(lat2d)
nlat = dim2d(0)
mlon = dim2d(1)
;---Get the Daymet source variable
var = sfile->$vname$ ; (time, y, x)
;---Define assorted source grid (Daymet) options
Opt@SrcGridType = "curvilinear"
Opt@SrcGridLat = lat2d
Opt@SrcGridLon = lon2d
Opt@SrcRegional = True
Opt@SrcFileName = srcPathName ; grid description of
source tile
;---Create the destination lat/lon grid
dll = 0.1 ; tenth of degree spacing
kpts= toint(2.0/dll)+1 ; 2 deg is Daymet grid spacing
lat = fspan( min(lat2d),max(lat2d), kpts )
lon = fspan( min(lon2d),max(lon2d), kpts )
printVarSummary(lat)
printVarSummary(lon)
Opt@DstGridType = "curvilinear"
Opt@DstGridLat = lat
Opt@DstGridLon = lon
Opt@DstRegional = True
Opt@DstFileName = dstPathName ; grid description of source tile
;---Set method
Opt@InterpMethod = method
var_regrid = ESMF_regrid(var,Opt) ; Do the regridding for 'var'
printVarSummary(var_regrid)
end
=============================================================================
Thanks
Kamal
Quoting Mary Haley <haley@ucar.edu>:
> Hi Kamal,
>
> You can't simply change the DstGridType to curvilinear. Really, that option
> should only be used when you are calling ESMF_regrid_with_weights.
>
> A curvilinear grid means you have two-dimensional (2D) lat/lon arrays that
> represent the grid.
>
> If you want to regrid to a curvilinear grid, then you need to provide the
> curvilinear lat/lon coordinates via these two options:
>
> Opt@DstGridLat = lat
> Opt@DstGridLon = lon
> In this particular example, "lat" and "lon are calculated as 1D
> coordinate arrays. You need to
> replace this code with the 2D lat/lon arrays that represent your
> curvilinear grid.
>
> --Mary
>
> On Feb 20, 2013, at 2:29 PM, mmkamal@uwaterloo.ca wrote:
>
>> Hi,
>>
>> I have been trying to re-grid DAYMET 1km dataset into 8km using the
>> example NCL script prepared to convert from curvlinear to rectilinear
>> grd (http://www.ncl.ucar.edu/Applications/Scripts/daymet_3.ncl). My
>> problem is that I want to convert 1km curvlinear DAYMET data into 8km
>> curvlinear dataset. Therefore, I set the
>>
>> Opt@DstGridType = "curvilinear"
>>
>>
>> I have not changed any other option in the example script. The script
>> works fine when used to convert from curvlinear to rectilinear grd but
>> failed when trying to use to convert 1km curvlinear DAYMET data into
>> 8km curvlinear data set. It gives the following error message:
>>
>>
>> gpc-f101n084-$ ncl test.ncl
>> Copyright (C) 1995-2012 - All Rights Reserved
>> University Corporation for Atmospheric Research
>> NCAR Command Language Version 6.1.0
>> The use of this software is governed by a License Agreement.
>> See http://www.ncl.ucar.edu/ for more details.
>>
>> Variable: lat
>> Type: double
>> Total Size: 168 bytes
>> 21 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [21]
>> Coordinates:
>>
>> Variable: lon
>> Type: double
>> Total Size: 168 bytes
>> 21 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [21]
>> Coordinates:
>> fatal:Number of dimensions in parameter (1) of (curvilinear_to_SCRIP)
>> is (1), (2) dimensions were expected
>> fatal:["Execute.c":7743]:Execute: Error occurred at or near line 2978
>> in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
>>
>> fatal:["Execute.c":7743]:Execute: Error occurred at or near line 3098
>> in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
>>
>> fatal:["Execute.c":7743]:Execute: Error occurred at or near line 100
>> in file test.ncl
>>
>>
>>
>> ==================================================
>> Here is the source data description:
>> ==================================================
>> gpc-f101n084-$
>> /scinet/gpc/Libraries/netcdf-4.1.3/serial_gcc/bin/ncdump -h
>> prcp.2010_12296.nc
>> netcdf prcp.2010_12296 {
>> dimensions:
>> x = 212 ;
>> y = 250 ;
>> time = 365 ;
>> nv = 2 ;
>> variables:
>> short lambert_conformal_conic ;
>> lambert_conformal_conic:grid_mapping_name =
>> "lambert_conformal_conic" ;
>> lambert_conformal_conic:longitude_of_central_meridian
>> = -100. ;
>>
>> lambert_conformal_conic:latitude_of_projection_origin = 42.5 ;
>> lambert_conformal_conic:false_easting = 0. ;
>> lambert_conformal_conic:false_northing = 0. ;
>> lambert_conformal_conic:standard_parallel = 25., 60. ;
>> double x(x) ;
>> x:units = "m" ;
>> x:long_name = "x coordinate of projection" ;
>> x:standard_name = "projection_x_coordinate" ;
>> double y(y) ;
>> y:units = "m" ;
>> y:long_name = "y coordinate of projection" ;
>> y:standard_name = "projection_y_coordinate" ;
>> double time(time) ;
>> time:long_name = "time" ;
>> time:calendar = "standard" ;
>> time:units = "days since 1980-01-01 00:00:00 UTC" ;
>> time:bounds = "time_bnds" ;
>> double lat(y, x) ;
>> lat:units = "degrees_north" ;
>> lat:long_name = "latitude coordinate" ;
>> lat:standard_name = "latitude" ;
>> double lon(y, x) ;
>> lon:units = "degrees_east" ;
>> lon:long_name = "longitude coordinate" ;
>> lon:standard_name = "longitude" ;
>> short yearday(time) ;
>> yearday:long_name = "yearday" ;
>> yearday:valid_range = 1s, 365s ;
>> float prcp(time, y, x) ;
>> prcp:long_name = "daily total precipitation" ;
>> prcp:units = "mm/day" ;
>> prcp:missing_value = -9999.f ;
>> prcp:_FillValue = -9999.f ;
>> prcp:valid_range = 0.f, 200.f ;
>> prcp:coordinates = "lat lon" ;
>> prcp:grid_mapping = "lambert_conformal_conic" ;
>> prcp:cell_methods = "area: sum time: sum" ;
>> double time_bnds(time, nv) ;
>>
>> // global attributes:
>> :tileid = 12296s ;
>> :start_year = 2010s ;
>> :source = "Daymet Software Version 2.0" ;
>> :Version_software = "Daymet Software Version 2.0" ;
>> :Version_data = "Daymet Data Version 2.1" ;
>> :Conventions = "CF-1.4" ;
>> :citation = "Please see http://daymet.ornl.gov/ for
>> current Daymet data citation information" ;
>> :references = "Please see http://daymet.ornl.gov/ for
>> current information on Daymet references" ;
>> }
>>
>> ===========================================================================
>>
>>
>> I look forward to hearing from you.
>>
>> Thanks
>> Kamal
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
Received on Thu Feb 21 11:08:38 2013
This archive was generated by hypermail 2.1.8 : Fri Feb 22 2013 - 17:42:16 MST