Re: Regridding Daymet Joined Tiles with ESMF_Regridding on NCL 6.1.0

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Nov 19 2012 - 11:18:53 MST

Ping,

Without knowing the size of your variables, it's hard to tell what you are trying to do.

The error is telling exactly what you're doing wrong:

> fatal:Number of subscripts do not match number of dimensions of variable,(1) Subscripts used, (2) Subscripts expected

You are trying to subscript lat2d and lon2d as if they were 1D arrays.

If lat and lon are the same size as lat2d and lon2d, then you can use "where", instead of a do loop:

  lat = where(lat.eq.0,lat2d,lat)
  lon = where(lon.eq.0,lon2d,lon)

--Mary

On Nov 19, 2012, at 10:33 AM, Ping Yang wrote:

> Dear NCL,
>
> Here is an update on the Daymet data issues.
>
> Big thanks to Dave who provided a data file that contained full coordinates for the study area generated by Geotrans software.
>
> Now I used a script to replace the missing (zero) value in the merged file, however, there are some problems with it:
>
> begin
>
> Variable = "prcp"
> nx = 1551
> ny = 1872
> N = nx * ny
> ;full_coordinate.dat
> file1="full_coordinate.dat" ;the coordinate file
>
> z3 = asciiread(file1,(/N,4/),"double")
>
> lat1d=z3(:,2)
> lon1d=z3(:,3)
> dim2=(/ny,nx/)
> lat2d=onedtond(lat1d,dim2)
> lon2d=onedtond(lon1d,dim2)
> printVarSummary(lat2d)
> printVarSummary(lon2d)
> ;--find the zero value in the 2d lat and lon from the merged grid file
> ;NE_all_1980_prcp.nc
> file2= "NE_all_1980_" + Variable + ".nc"
> f = addfile(file2,"r")
> lat = f->lat
> lon = f->lon
> printVarSummary(lat)
> printVarSummary(lon)
> ;--fill the zero with the generated coordinates
> do i = 0, N
> if(lat(i) .eq. 0) then lat(i)=lat2d(i) end if
> if(lon(i) .eq. 0) then lon(i)=lon2d(i) end if
> end do
> printVarSummary(lat)
> printVarSummary(lon)
> end
>
> I got error:
> fatal:Number of subscripts do not match number of dimensions of variable,(1) Subscripts used, (2) Subscripts expected
> fatal:["Execute.c":7743]:Execute: Error occurred at or near line 42 in file assign_coordinate.ncl
>
> However, I tried to using the following code to replace the zero value:
> if(lat(i,:) .eq. 0) then lat(i,:)=lat2d(i,:) end if
> if(lon(i,:) .eq. 0) then lon(i,:)=lon2d(i,:) end if
> but another error occurred:
> fatal:Conditional statements (if and do while) require SCALAR logical values, see all and any functions
> fatal:["Execute.c":7743]:Execute: Error occurred at or near line 42 in file assign_coordinate.ncl
>
> How to operate on this 2D array for replacing the zero values? Am I missing some information?
>
> Looking forward to hearing from you.
>
> Big thanks,
>
> Ping
> _______________________________________________
> 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 Mon Nov 19 11:19:02 2012

This archive was generated by hypermail 2.1.8 : Wed Nov 21 2012 - 11:16:05 MST