HydrologicEngineeringCenter / Vortex

data processing utilities
MIT License
27 stars 7 forks source link

Example of a time shifter python file #114

Open Gauravfouzdar opened 5 days ago

Gauravfouzdar commented 5 days ago

Example of a time shifter python file like this for the latest version where it will have start time and end time ?

Gauravfouzdar commented 5 days ago

this is not helful as it shift both time

"from mil.army.usace.hec.vortex.math import Shifter from mil.army.usace.hec.vortex.io import DataReader

from java.time import Duration

inDSS = r'C:\in.dss' outDSS = r'C:\out.dss'

shiftby = Duration.ofMinutes(30)

All units options:

https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#:~:text=the%20specified%20unit.-,static%20Duration,Obtains%20a%20Duration%20representing%20a%20number%20of%20seconds.,-static%20Duration

find all pathnames:

sourceGrids = DataReader.getVariables(inDSS)

write_opts = { 'partA': 'A_part', 'partC': 'PRECIPITATION', 'dataType': 'PER-CUM', 'units': 'MM' }

shifty = Shifter.Builder()\ .pathToFile(inDSS)\ .grids(sourceGrids)\ .destination(outDSS)\ .shift(shiftby)\ .writeOptions(write_opts)\ .build()

shifty.shift()"

tombrauer commented 5 days ago

Shift start:

        Shifter shifter = Shifter.builder()
                .shift(Duration.ofHours(-6))
                .methods(Set.of(TimeShiftMethod.START))
                .pathToFile(in)
                .grids(variables)
                .destination(out)
                .build();

Shift end:

        Shifter shifter = Shifter.builder()
                .shift(Duration.ofHours(-6))
                .methods(Set.of(TimeShiftMethod.END))
                .pathToFile(in)
                .grids(variables)
                .destination(out)
                .build();

Shift start and end:

        Shifter shifter = Shifter.builder()
                .shift(Duration.ofHours(-6))
                .methods(Set.of(TimeShiftMethod.START, TimeShiftMethod.END))
                .pathToFile(in)
                .grids(variables)
                .destination(out)
                .build();

or

        Shifter shifter = Shifter.builder()
                .shift(Duration.ofHours(-6))
                .pathToFile(in)
                .grids(variables)
                .destination(out)
                .build();
Gauravfouzdar commented 2 days ago

in this part, if i have to change projection to UTM 44N , how to do that "geo_options = {{ 'pathToShp': clip_shp, 'targetCellSize': '2000', 'targetWkt': WktFactory.shg(),###### 'resamplingMethod': 'Bilinear' }}

tombrauer commented 2 days ago

'targetWkt': WktFactory.create("UTM44N");