[gdal-dev] Batch Processing for gdal_calc.py

Chaitanya kumar CH chaitanya.ch at gmail.com
Fri May 11 05:02:24 EDT 2012


Swapnil,

I'm not sure which shell script you are running, but in bash, you need to
have semicolons somewhere there.

The -scale option does a linear stretch of the pixel values. So, if you
have values ranging from 0 to 250, "-scale 0 250 0 25" will do the job you
are trying to do.

Please add the error messages if you still have any more problems.

On Fri, May 11, 2012 at 11:05 AM, Swapnil Chaudhari <swapsslan at gmail.com>wrote:

> Hi Chaitanya,
>
> Thank you for your response. I tried inserting the --format option. It
> still gives me the same error.
> I would be glad if you can describe the --scale function. It asks for
> , [-scale [src_min src_max [dst_min dst_max]]]
> How do you put a formula here? like "raster/10"
>
> Thanks a ton! I think you have given me a way to do it.
>
> Swapnil
>   o__
>  _> /__
> (_) \(_)....... live healthy
>
>
>
> On Fri, May 11, 2012 at 10:42 AM, Chaitanya kumar CH
> <chaitanya.ch at gmail.com> wrote:
> > Swapnil,
> >
> > You missed the --format option with gdal_calc. If you don't mention it,
> it
> > assumes the default format, GeoTiff.
> >
> > Since the operation is simple, you should be able to do that using
> > gdal_translate using the -scale option. It also has the -projwin option
> to
> > select the extents.
> >
> > On Fri, May 11, 2012 at 9:59 AM, Swapnil Chaudhari <swapsslan at gmail.com>
> > wrote:
> >>
> >> Dear All,
> >>
> >> I would like to get your advise on running gdal_calc using shell.
> >> I am finding it difficult, mostly because the command requires you to
> >> define what  -A stands for etc. which is quite different from
> >> gdal_translate or such similar tools, so is the case with Raster
> >> package in R.
> >>
> >> I wish to scale all the temperature ascii grids that I have for quite
> >> a few number of folders.
> >>
> >> I wrote following sh file
> >>
> >> for f in *.tif
> >> do
> >>   echo "Processing $f"
> >>   gdal_calc -A $f --outfile=$f_scaled.asc --calc=A/10
> >> done
> >>
> >>
> >> However, I am making a mistake somewhere, it does not read above
> >> script as a command. I wish to divide all the rasters with 10 and also
> >> equally wish to make all output files extent as "-projwin -180.0 90.0
> >> 180.0 -60.0" and column 720 with rows 300
> >>
> >> I would be really thankful if you can give some suggestion on this.
> >>
> >> Thanks a ton.
> >>
> >> Swapnil Chaudhari
> >>
> >>   o__
> >>  _> /__
> >> (_) \(_)....... live healthy
> >> _______________________________________________
> >> gdal-dev mailing list
> >> gdal-dev at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >
> >
> >
> > --
> > Best regards,
> > Chaitanya kumar CH.
> >
> > +91-9494447584
> > 17.2416N 80.1426E
>



-- 
Best regards,
Chaitanya kumar CH.

+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120511/554d9f11/attachment.html


More information about the gdal-dev mailing list