Re: regridding the data to a rectiliniear lat / lon grid

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Oct 26 2012 - 11:36:46 MDT

Since the date 2x2 degree tile have a spacing of 1km
and you said you wanted a 4km grid, the 'k=4' is a
*crude proxy* for 4km.

See Attached

Some explanatory code is commented.

Good luck

On 10/25/12 6:51 PM, Ping Yang wrote:
> Hi NCL,
>
> I think you misunderstanding my previous question. I was looking for a
> place to upload my sample file of Daymet in order that you or other
> specialist can have a look (I've already downloaded the file)
>
> My question is particularly on the daymet data regridding using average
> method.
>
> k = 4 (what does k mean?)
> k2 = k/2
> var_avg = new ( (/ntim, nlat/k,mlon/k /), typeof(var), getFillValue(var))
> do nl=k2,nlat-3,k
> do ml=k2,mlon-3,k
> var_avg(:,nl,ml) = avg(var(:,nl-k2:nl+k2,ml-k2:ml+k2))
> end do
> end do
>
> LAT2D = lat2d(k2::k,k2::k) ; subset why here need a subset?
> LON2D = lon2d(k2::k,k2::k)
>
> Thanks,
>
> Ping
>
>
>
> On Thu, Oct 25, 2012 at 4:54 PM, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>> wrote:
>
> Hello, You keep cc'ing me on these 'Daymet' questions.
> I have no experience with daymet data.
>
> Downloading 'Daymet' files in not an NCL question. These should be
> sent to the 'Daymet' contact email.
>
> The Daymet WWW does offer examples on how to Download.
> http://daymet.ornl.gov/__dataaccess <http://daymet.ornl.gov/dataaccess>
>
> One example: I successfully tried from the command line
>
> %> wget --limit-rate=3m
> http://daymet.ornl.gov/__thredds/fileServer/allcf/2010/__12296_2010/prcp.nc
> <http://daymet.ornl.gov/thredds/fileServer/allcf/2010/12296_2010/prcp.nc>
> -O prcp.2010_12296.nc <http://prcp.2010_12296.nc>
> ------------------------------__------------------------------
>
> ------------------------------__------------------------------__-
>
> From the Climate Data Guide. Other download links are provided:
>
> http://climatedataguide.ucar.__edu/guidance/daymet-daily-__surface-weather-and-__climatological-summaries
> <http://climatedataguide.ucar.edu/guidance/daymet-daily-surface-weather-and-climatological-summaries>
>
>
> On 10/25/12 12:00 PM, Ping Yang wrote:
>
> Hi NCL,
>
> Where can I upload a sample file here? I got the variables
> information
> using ncdump -c in the following:
>
> netcdf \12296_2010_prcp {
> 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" ;
>
> I tried to follow your instructions the average method:
>
> f = "11569" + "_1980_" + var + ".nc"
> o = + "_1980_" + var + "_4km_" + ".nc"
> f = addfile (file1, "r") ; open input files
> var = f->prcp(:,:,:)
> ; var(ntim,nlat,mlon) ; variable on Daymet tile netCDF file
> k = 4
> k2 = k/2
> var_avg = new ( (/ntim, nlat/k,mlon/k /), typeof(var),
> getFillValue(var))
> do nl=k2,nlat-3,k
> do ml=k2,mlon-3,k
> var_avg(:,nl,ml) = avg(var(:,nl-k2:nl+k2,ml-k2:__ml+k2))
> end do
> end do
>
> LAT2D = lat2d(k2::k,k2::k) ; subset
> LON2D = lon2d(k2::k,k2::k)
>
> However, I don't know how to figure out the coordinates and subset.
> Would you please let me know how to do it?
>
> Looking forward to hearing from you.
>
> Ping
>
> On Wed, Oct 24, 2012 at 11:24 AM, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>
> <mailto:shea@ucar.edu <mailto:shea@ucar.edu>>> wrote:
>
> As I mentioned earlier, I have no experience with Daymet tiles.
> I think you will have to discover the best way to handle these.
>
> What I meant was something like
>
> var(ntim,nlat,mlon) ; variable on Daymet tile netCDF file
>
> k = 4
> k2 = k/2
> var_avg = new ( (/ntim, nlat/k,mlon/k /), typeof(var),
> getFillValue(var))
>
> do nl=k2,nlat-3,k
> do ml=k2,mlon-3,k
> var_avg(:,nl,ml) =
> avg(var(:,nl-k2:nl+k2,ml-k2:____ml+k2))
>
> end do
> end do
>
> LAT2D = lat2d(k2::k,k2::k) ; subset
> LON2D = lon2d(k2::k,k2::k)
>
> Good luck
>
> On 10/23/12 8:39 PM, Ping Yang wrote:
>
> Hi NCL,
>
> On Tue, Oct 23, 2012 at 4:12 PM, Dennis Shea
> <shea@ucar.edu <mailto:shea@ucar.edu>
> <mailto:shea@ucar.edu <mailto:shea@ucar.edu>>
> <mailto:shea@ucar.edu <mailto:shea@ucar.edu>
> <mailto:shea@ucar.edu <mailto:shea@ucar.edu>>>> wrote:
>
> Given the small area covered by the 2x2 tiles at 1km
> resolution.
> I think it would be just fine to compute a local
> 4kmx4km
> arithmetic
> average. The grid center would the mid point of the
> lat and lon used.
>
> What do you mean local 4kmx4km arithmetic average? Is
> this a
> regriding
> method?
>
> Looking forward to hearing from you.
>
> Regards,
>
> Ping
>
>
>
>
> --
> Ping Yang, Ph.D.
> CUNY Environmental Crossroads Initiative
> Marshak Science Building - Suite 925
> The City College of New York - CUNY
> 160 Convent Avenue, New York NY 10031
> Phone: 212-650-5769 <tel:212-650-5769>
> Fax: 212-650-7064 <tel:212-650-7064>
>
>
>
>
> --
> Ping Yang, Ph.D.
> CUNY Environmental Crossroads Initiative
> Marshak Science Building - Suite 925
> The City College of New York - CUNY
> 160 Convent Avenue, New York NY 10031
> Phone: 212-650-5769 <tel:212-650-5769>
> Fax: 212-650-7064
>

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

Received on Fri Oct 26 11:40:20 2012

This archive was generated by hypermail 2.1.8 : Wed Oct 31 2012 - 09:14:12 MDT