Re: netcdf subsetting in NCL

From: Maria Gehne - NOAA Affiliate <maria.gehne_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 07 2014 - 17:18:33 MDT

Hi Naoki,

the error is saying the longitudes you are specifying are out of range.
Have you tried printing out the longitude values associated with the
precipitation data to make sure they range from 0-360 and not -180 to 180?

Maria


On Mon, Jul 7, 2014 at 3:48 PM, Naoki Mizukami <mizukami@ucar.edu> wrote:

> Hi,
>
> This should be simple, but cannot figure out why.... also this script
> used to work before
>
> I am reading netCDF file (with coordinate variables in the netCDF)
> and trying to subset it within lat/lon boundary I want. I keep getting
> errors.
>
> My script (only relevant part) is like the below
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> begin
> dstyp =(/"BCCA","BCSD","BCSDdisag","BCSAR"/)
> ; get list of files to be processed
> dirc = "/d4/mizukami/forcing_data/VIC/netcdf/"
>
> do i = 4,4 ;loop for dstype i=1->BCCA, i=2->BCSD,
> i=3->BCSDdisag i=4 -> BCSAR
> do yr=1979,1979 ;loop for year
> filpr = systemfunc("ls
> "+dirc+dstyp(i-1)+"/ccsm/pr/"+dstyp(i-1)+"_pr_12km_"+tostring(yr)+".nc")
> fpr = addfile(filpr, "r")
> pr = fpr->pr(:,{25.1875:50.6875},{235.3125:292.9375}) ;
> pr(time, lat, lon)
> t = fpr->time
> pr@long_name = "daily total precipitation"
> pr@units = "mm/day"
> printVarSummary(pr)
> ....
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> I am getting message like
>
> Copyright (C) 1995-2013 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 6.1.2
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> fatal:["NclAdvancedFile.c":2869]:Subscript out of range, error in
> subscript #2
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 28 in
> file Process1_downscaled_forcing_nc.ncl
>
> line 28 -> r = fpr->pr(:,{25.1875:50.6875},{235.3125:292.9375})
>
> It should be inside boundary.
>
> I would appreciate any clues.
>
>
> thanks
>
> National Center for Atmospheric Research
> 3450 Mitchell Lane
> Boulder, CO 80301
>
> Office FL2 3094H
> Phone 303-497-2739
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

Received on Mon Jul 07 11:19:06 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT