Debian Codegraph @

tests/grib_idx_fixtures/README.md

raw
1 # Fixture data
2
3 To examine json.gz fixture files on the command line use *zcat* & *jq*
4 ```console
5 zcat tests/fixtures/hrrr.wrfsubhf/zarr_tree_store_v1.json.gz | jq .
6 ```
7 To examine the parquet files you need to use jupyter notebook or a debugger
8
9
10 HRRR Sub hourly test data
11 ```
12 gs://high-resolution-rapid-refresh/hrrr.20210928/conus/hrrr.t01z.wrfsubhf00.grib2
13 gs://high-resolution-rapid-refresh/hrrr.20210928/conus/hrrr.t01z.wrfsubhf01.grib2
14 ```
15
16 HRRR Surface 2d test data
17 ```
18 gs://high-resolution-rapid-refresh/hrrr.20210928/conus/hrrr.t01z.wrfsfcf00.grib2
19 gs://high-resolution-rapid-refresh/hrrr.20210928/conus/hrrr.t01z.wrfsfcf01.grib2
20 ```
21
22 GFS pgrb2 0p25 test data
23 ```
24 gs://global-forecast-system/gfs.20230928/00/atmos/gfs.t00z.pgrb2.0p25.f000
25 gs://global-forecast-system/gfs.20230928/00/atmos/gfs.t00z.pgrb2.0p25.f001
26 gs://global-forecast-system/gfs.20230928/00/atmos/gfs.t00z.pgrb2.0p25.f002
27 gs://global-forecast-system/gfs.20230928/06/atmos/gfs.t06z.pgrb2.0p25.f000
28 gs://global-forecast-system/gfs.20230928/06/atmos/gfs.t06z.pgrb2.0p25.f001
29 gs://global-forecast-system/gfs.20230928/06/atmos/gfs.t06z.pgrb2.0p25.f002
30 ```
31
32 ## To make more fixture data
33
34 Copy data with a command like:
35 ```console
36 gsutil -m cp gs://high-resolution-rapid-refresh/hrrr.20230928/conus/hrrr.t00z.wrfsfcf* testdata/.
37 ```
38
39 Call scan_grib to read the files and filter the results message groups for interesting keys e.g. starting with "dswrf" or "u". Even a single grib file will be huge for all messages.
40
41 ```python
42 scans = scan_grib("testdata/hrrr.t01z.wrfsubhf00.grib2")
43 scans += scan_grib("testdata/hrrr.t01z.wrfsubhf01.grib2")
44 jsets = []
45 vname = "dswrf"
46 for gg in scans:
47 if "dswrf/.zattrs" in gg['refs'] or "u/.zattrs" in gg['refs']:
48 jsets.append(gg)
49
50 with gzip.open("ingestion/noaa_nwp/tests/fixtures/hrrr.wrfsubhf.subset.json.gz", 'w') as f:
51 ss = ujson.dumps(jsets)
52 f.write(ss)
53 ```
54
55 To make reinflate test parquet chunk indexes... load data from ingestion extract a single parquet file
56 ```python
57 gfs_base_path = "gs://dev.camus-infra.camus.store/davetest/gfs"
58 gfs_kind = dd.read_parquet(
59 [f.full_name for f in fsspec.open_files(os.path.join(gfs_base_path, "data_index/**.parquet"))],
60 index=False
61 ).compute()
62 gfs_kind.loc[
63 gfs_kind.varname.isin(["u", "dswrf"]) &
64 (gfs_kind.valid_time <= "2023-09-28 04:00:00")
65 ].to_parquet("/home/builder/bando/ingestion/noaa_nwp/tests/fixtures/gfs.pgrb2.0p25/test_reinflate.parquet")
66 ```
67
68
69 Make truncated grib files and idx files with make_test_grib_idx_files
70 ```python
71 fs = fsspec.filesystem("gcs")
72 dynamic_zarr_store.make_test_grib_idx_files(
73 fs=fs,
74 basename="gs://camus-infra.camus.store/circleci_test_data/bando/ingestion/noaa_nwp/tests/fixtures/20221014/hrrr.t01z.wrfsubhf00.grib2"
75 )
76 ```
77 Copy the files from the NODD bucket first, then truncate, so we keep the original artifact too.
78 e.g. `gsutil cp gs://global-forecast-system/gfs.20221014/00/atmos/gfs.t00z.pgrb2.0p25.f000* gs://camus-infra.camus.store/circleci_test_data/bando/ingestion/noaa_nwp/tests/fixtures/20221014/`