Skip to content

Commit

Permalink
fix(ci): apply pre-commit change to remainder of R/
Browse files Browse the repository at this point in the history
  • Loading branch information
spool committed Nov 23, 2023
1 parent a704f7c commit 30ab294
Show file tree
Hide file tree
Showing 10 changed files with 455 additions and 466 deletions.
24 changes: 11 additions & 13 deletions R/misc/Cropping_Rasters_to_three_cities.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Crop CPM and HADs
## Crop CPM and HADs

rm(list=ls())
#setwd("~/Desktop/clim-recal/clim-recal/")
Expand All @@ -14,7 +14,7 @@ dd <- "/mnt/vmfileshare/ClimateData/"

## Using the extents (ie full grid) rather than masking and cropping to city outlines

# 1. London
# 1. London
f <- paste0(dd,'shapefiles/NUTS_Level_1_January_2018_FCB_in_the_United_Kingdom_2022_7279368953270783580/NUTS_Level_1_January_2018_FCB_in_the_United_Kingdom.shp')
UK.shape <-vect(f)
London <- UK.shape[which(UK.shape$nuts118cd=="UKI")]
Expand Down Expand Up @@ -57,8 +57,8 @@ ext.L <- list(London.ext, Glasgow.ext, Manchester.ext)
names(ext.L) <- cities

lapply(cities, function(x){
cpm_read_crop(runs=runs, var = var,

cpm_read_crop(runs=runs, var = var,
fp = paste0(dd, "Reprojected_infill/UKCP2.2/"),
rd = paste0(dd, "Cropped/three.cities/CPM/"),
crop.area=ext.L[[x]],
Expand All @@ -71,26 +71,24 @@ lapply(cities, function(x){
var <- c("tasmax", "tasmin", "rainfall")

lapply(cities, function(x){
hads_read_crop(var = var,
fp= paste0(dd, "Processed/HadsUKgrid/resampled_2.2km/"),

hads_read_crop(var = var,
fp= paste0(dd, "Processed/HadsUKgrid/resampled_2.2km/"),
rd= paste0(dd, "Cropped/three.cities/Hads.original360/"),
file.date="19801201", #Start from the same date as the CPM
crop.area=ext.L[[x]],
cropname=x) })


#### HADs - updated 360 calendar
#### HADs - updated 360 calendar

var <- c("tasmax", "tasmin", "rainfall")

lapply(cities, function(x){
hads_read_crop(var = var,
fp= paste0(dd, "Processed/HadsUKgrid/resampled_calendarfix/"),

hads_read_crop(var = var,
fp= paste0(dd, "Processed/HadsUKgrid/resampled_calendarfix/"),
rd= paste0(dd, "Cropped/three.cities/Hads.updated360/"),
file.date="19801201", #Start from the same date as the CPM
crop.area=ext.L[[x]],
cropname=x) })


4 changes: 2 additions & 2 deletions R/misc/HAD.CRS.for.sourcing.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#crs as extracted from the reprojected HADs files
#this should be updated when hads is reprojected as suspect lots is incorrect
#this should be updated when hads is reprojected as suspect lots is incorrect

HAD.CRS = "PROJCRS[\"undefined\",\n BASEGEOGCRS[\"undefined\",\n DATUM[\"undefined\",\n ELLIPSOID[\"undefined\",6377563.396,299.324961266495,\n LENGTHUNIT[\"metre\",1,\n ID[\"EPSG\",9001]]]],\n PRIMEM[\"undefined\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433,\n ID[\"EPSG\",9122]]]],\n CONVERSION[\"unnamed\",\n METHOD[\"Transverse Mercator\",\n ID[\"EPSG\",9807]],\n PARAMETER[\"Latitude of natural origin\",49,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8801]],\n PARAMETER[\"Longitude of natural origin\",-2,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8802]],\n PARAMETER[\"Scale factor at natural origin\",0.9996012717,\n SCALEUNIT[\"unity\",1],\n ID[\"EPSG\",8805]],\n PARAMETER[\"False easting\",400000,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8806]],\n PARAMETER[\"False northing\",-100000,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8807]]],\n CS[Cartesian,2],\n AXIS[\"easting\",east,\n ORDER[1],\n LENGTHUNIT[\"metre\",1,\n ID[\"EPSG\",9001]]],\n AXIS[\"northing\",north,\n ORDER[2],\n LENGTHUNIT[\"metre\",1,\n ID[\"EPSG\",9001]]]]"
HAD.CRS = "PROJCRS[\"undefined\",\n BASEGEOGCRS[\"undefined\",\n DATUM[\"undefined\",\n ELLIPSOID[\"undefined\",6377563.396,299.324961266495,\n LENGTHUNIT[\"metre\",1,\n ID[\"EPSG\",9001]]]],\n PRIMEM[\"undefined\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433,\n ID[\"EPSG\",9122]]]],\n CONVERSION[\"unnamed\",\n METHOD[\"Transverse Mercator\",\n ID[\"EPSG\",9807]],\n PARAMETER[\"Latitude of natural origin\",49,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8801]],\n PARAMETER[\"Longitude of natural origin\",-2,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8802]],\n PARAMETER[\"Scale factor at natural origin\",0.9996012717,\n SCALEUNIT[\"unity\",1],\n ID[\"EPSG\",8805]],\n PARAMETER[\"False easting\",400000,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8806]],\n PARAMETER[\"False northing\",-100000,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8807]]],\n CS[Cartesian,2],\n AXIS[\"easting\",east,\n ORDER[1],\n LENGTHUNIT[\"metre\",1,\n ID[\"EPSG\",9001]]],\n AXIS[\"northing\",north,\n ORDER[2],\n LENGTHUNIT[\"metre\",1,\n ID[\"EPSG\",9001]]]]"
Loading

0 comments on commit 30ab294

Please sign in to comment.